我的问题是,当在一列中添加文本溢出时,我会丢失其他列的所有格式
<table id="table" data-show-header="false" >
<thead>
<tr>
<th data-field="state" data-checkbox="true" data-formatter="check"></th>
<th data-field="fav" data-formatter="formatoFav" ></th>
<th data-field="nombre" class="col-md-2"></th>
<th data-field="asunto" class="col-md-10 abbreviation"></th>
<th data-field="hora" data-formatter="formatoHora" data-align="right"></th>
</tr>
</thead>
这是没有css的结果
用CSS
.table {
table-layout:fixed;
}
.table td.abbreviation{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
答案 0 :(得分:2)
溢出需要固定宽度(或高度,如果需要)才能正常工作,因为您可以在溢出文档中看到。如果你没有在想要溢出的div上设置宽度和高度,那么当溢出的父元素时它会被隐藏(这会导致你的问题)。
已编辑:根据帖子更好的例子
请参阅以下示例:
div.foo{background:#000; width:250px;}
div.foc{width:200px; border:1px solid white;}
div.fo1{overflow:hidden; background:#A44;}
div.fo2{width:100px; height:100px; overflow:hidden; color:#FFF;}
<div class="foo">
<div class="foc">
<div class="fo1">
<span>lalalalaauoshdoajhsdaodshdaojshdaosdhaosldhaoshdasdhaslkdnalsjdnljdalfblaskdfblsakdfbalkfbakldsbfkladsfblkadfbkladfbakldfbakldsbfaksbfkasfbalkdfbksdbfksadjbfkjadsbfkldfblaksdbfkladsbfkladsfbakdsfbdskjbfkbadskfbasldkfbjsadklfbakjdsbfjksad</span>
</div>
<div class="fo2">
<span> auoshdoajhsdaodshdaojshdaosdhaosldhaoshdasdhaslkdnalsjdnljdalfblaskdfblsakdfbalkfbakldsbfkladsfblkadfbkladfbakldfbakldsbfaksbfkasfbalkdfbksdbfksadjbfkjadsbfkldfblaksdbfkladsbfkladsfbakdsfbdskjbfkbadskfbasldkfbjsadklfbakjdsbfjksad
</span>
</div>
</div>
</div>
尝试删除宽度:div.foc的200px并查看happer。
希望它有所帮助, 干杯! =)