表td的垂直溢出

时间:2011-01-26 22:47:02

标签: css html-table overflow

是否可以为在垂直方向上工作的表td设置隐藏或可见溢出?

http://jsfiddle.net/jkXBH/

3 个答案:

答案 0 :(得分:7)

你必须将你的td内容包装成div并设置div的宽度和高度,不能隐藏溢出内容。

http://jsfiddle.net/Wx58E/

答案 1 :(得分:0)

您可以使用overflow-y:hidden;

答案 2 :(得分:0)

在每个td类上设置max-width css属性以使溢出工作,不需要div

td
{
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

对于IE,你需要在你的html中修复IE特定的渲染问题(直到IE9)

<!--[if IE]>
<style>
    table
    {
        table-layout: fixed;
    }
</style>
<![endif]-->
相关问题