我试着按照这里的解释:How to wrap table cell at a maximum width in full width table
但我无法制作一些东西来包装我的“xxxxxxxxxxxxx”行。
<table class="my-list table table-bordered table-hover">
<tbody>
<tr>
<th>User id</th>
<th>User name</th>
<th>Type</th>
<th>Id</th>
<th>Ad content</th>
<th>Created at</th>
</tr>
<tr>
<td>66666</td>
<td>John Smith</td>
<td>type1</td>
<td>99999</td>
<td>
<div>
Good content with words and real sentences.
</div>
</td>
<td>2015-09-02</td>
</tr>
<tr>
<td>777777</td>
<td>Martin Isabelle</td>
<td>type2</td>
<td>888888</td>
<td>
<div>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</div>
</td>
<td>2015-09-02</td>
</tr>
</tbody>
</table>
最佳答案
CSS 代码:
table {
width: 100%;
}
td {
text-align: right;
white-space: nowrap;
}
td div {
white-space: normal;
word-break: break-all;
display: block;
}
关于html - 用长字包裹表格单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32778339/