我有一个由backgrid生成的网格。
我想限制文本长度,每个td必须在一行上。
td上的width属性无效。
感谢您的帮助。
答案 0 :(得分:3)
根据您定义'限制'的方式,您可以简单地阻止包装和控制溢出:
td{
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
这会将内容保留为一行,如果文本内容超出td
答案 1 :(得分:1)
你需要把'td'标签的文本放在'p'标签中,并给td标签一个像<td class="content_td"><p>Your text</p></td>
这样的类
然后你可以像
.content_td p {
max-width: 100%;
max-height: 100px;
overflow-y: scroll;
text-overflow: ellipsis;
}