overflow on table td

  • 本文关键字:td table on overflow css
  • 更新时间 :
  • 英文 :


如何在表中的单元格上放置溢出属性?

http://jsfiddle.net/e8Bxj/

table {
    width:100px;
    height:100px;
}
td.content {
    overflow:auto;
}
<table>
    <tr>
        <td>hmm</td>
    </tr>
    <tr>
        <td class="content">
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
            sadfasf<br>
        </td>
    </tr>
    <tr>
        <td>hmm</td>
    </tr>
</table>

您需要将溢出的内容包装在div中。

http://jsfiddle.net/e8Bxj/1/

您只需添加

display:inline-block;

进入td,就像这个

id.content
{
display:inline-block;
overflow:auto;
}

试试这个小提琴