我有一些divs
with display: table-cell
样式,我想在其上设置固定宽度divs
并在内容不合适时截断其中的文本。
HTML
<div class="row">
<div class="cell" style="width:100px;">Should not fit in 100px</div>
</div>
CSS
.row {
display: table-row;
}
.cell {
display: table-cell;
border: solid 1px #DADADA;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
小提琴演示 http://jsfiddle.net/lgal/byx2d460/
是否可以?
您可以设置max-width
反而:
<div class="cell" style="max-width:100px;">Should not fit in 100px</div>
fiddle http://jsfiddle.net/byx2d460/1/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)