table 与 div 固定宽高问题

div {
width:100px;
height:200px;
word-wrap: break-word;
overflow:hidden;
}

这个可以固定div的宽高,溢出内容会被剪除。

table{
table-layout:fixed;
width:200px;
height:200px;
 }
td {
width:100px;
height:200px;
overflow:hidden;
}

这个只能固定td的宽度,而高度随内容增加而增高;若也要固定其高度,则需要在td中嵌套使用div,包住content,利用div的css。

如果 去除 table-layout:fixed; 情况则会反过来。

posted @ 2013-07-31 14:12  Yu  阅读(3684)  评论(0编辑  收藏  举报