< td>上的溢出属性不创建滚动条 [英] Overflow attribute on <td> does not create a scrollbar
本文介绍了< td>上的溢出属性不创建滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试用溢出创建表单元格< td>
但它不工作...
I trying to create a table cell <td>
with an overflow but it doesn't work...
有我的CSS代码:
td.blog_content
{
max-height: 50px;
overflow: auto;
width: 360px;
text-align: left;
padding: 2px;
}
而我的HTML:
<td class="blog_content"><?php echo $blog['content']; ?></td>
如果文本太长,会创建一个带滚动条的简单框...
It would create a simple box with a scrollbar if the text is too long...
推荐答案
尝试将它包装在< div>
中。我很确定overflow属性没有为< td>
元素定义,至少在 HTML4 不是。
Try wrapping it in a <div>
. I'm pretty sure the overflow attribute is not defined for a <td>
element, at least in HTML4 it's not.
<td class="blog_content">
<div><?php echo $blog['content']; ?></div>
</td>
.blog_content div {
height: 50px;
max-height: 50px;
overflow: auto;
}
这篇关于< td>上的溢出属性不创建滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文