Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 防止溢出:从剪切文本中隐藏_Css_Overflow - Fatal编程技术网

Css 防止溢出:从剪切文本中隐藏

Css 防止溢出:从剪切文本中隐藏,css,overflow,Css,Overflow,我有一个包含重复行(具有不同内容)的表,每个重复行包含以下相同的单元格: <td><img src="/images/a_photo.jpg" height="150" width="225"></td> <td class="right"> <div class="stuff"> <h4>Two or three words</h4><h5>Two or three more words</h

我有一个包含重复行(具有不同内容)的表,每个重复行包含以下相同的单元格:

<td><img src="/images/a_photo.jpg" height="150" width="225"></td>
<td class="right">
<div class="stuff">
<h4>Two or three words</h4><h5>Two or three more words</h5>
<p>Quite alot of words</p>
</div>
<div>
Always a single line of known height
</div>
</td>

有没有办法将(p)限制为整条线(垂直),或者我是在问不可能的事?

我通过另一种途径找到了解决方案

目前最大的问题是,(h4)和(h5)文本出现在第二行,但第二行有时是(h4)的高度,有时是(h5)的高度。这将(p)文本的可用空间更改了大约半行,因此我有时可能会得到文本行的上半部分

我已经放弃了(h4)并在(h5)中写下了所有的第一部分。这意味着前两行的高度始终相同,然后我可以调整剩余的空间以始终显示(p)文本的完整行


这仅适用于相当窄的屏幕(portait方向的平板电脑),因此当屏幕宽度低于阈值时,响应CSS仅将(h4)的高度更改为与(h5)相同。

静态高度的动态内容:(当它变为3行时会发生什么?或者当屏幕变小,2行文本变为3行时会发生什么?我会让您的内容确定单元格的高度,或者如果静态高度是绝对高度,那么必须在
div.stuff
中添加一个滚动条。是的,我知道这并不理想,但可变高度和滚动条都很难看。呃aps我必须使所有文本(包括h4和h5)具有相同的高度。但这是另一种设计折衷:(你的意思是你想将所有文本都放在一个特定的高度,还是你不介意容器(p)根据容器内的内容而变化?我为(h4)、(h5)和(p)提供了一个固定的空间).我可以接受,文本的最后部分将不可见,只要可见的行是完整的(不只是显示字母的顶部)。在理想情况下,删节的文本将以省略号结尾,但这可能要求太高。
h4{font-size:1.5em}
h5{font-size:0.9em}
td.right{overflow:hidden}