How to set the max number of text rows (wraps) in a td?
<table border="3">
<tr> <td class="table_class">111111 222222 333333 </td> <td class="table_class">234 </td> </tr开发者_开发知识库>
<tr> <td class="table_class">2321</td> <td class="table_class">ssS</td> </tr>
</table>
.table_class {
width: 20px;
}
Live example: http://jsfiddle.net/Nzd9K/
How can I "capture" numbers of rows in TD? For example,I would like max two rows in TD. I can use substr, but this isn't good idea. Extra text let be cut off.
You can add a wrapper div
with overflow: hidden
inside each td
.
See: http://jsfiddle.net/Nzd9K/17/
<td class="table_class"><div>111111 222222 333333</div></td>
.table_class div {
height: 2.5em; /* adjust to taste */
overflow: hidden
}
精彩评论