0
我有一个两列的表。 2列的宽度已设置,不应修改。第一列包含两个并排排列的跨度。第一个跨度的内容具有可变长度。第二跨度也。我想要做的是在内容碰到边界时隐藏第二个跨度的溢出。我尝试了几件事,但我无法找到解决方案。希望有人能帮忙。预先感谢您的回复。干杯。马克。css td溢出与可变长度跨度
我的HTML:
<table>
<tr>
<th>th1</th>
<th>th2</th>
</tr>
<tr>
<td>
<span>Paul</span>
<span class="hide-overflow">Some text with no overflow</span>
</td>
<td>txt</td>
</tr>
<tr>
<td>
<span>Emmanuelle</span>
<span class="hide-overflow">The overflow of this text string has to be hidden.The td has to be only one line and the width should not be extended.</span>
</td>
<td>txt</td>
</tr>
</table>
我的CSS:
table{
width:400px;
border-spacing: 0px;
border-collapse: collapse;}
th,td{
border:1px solid black;}
td:first-child{
width:350px;}
td:last-child{
width:50px;}
.hide-overflow{
background-color:yellow;
}
您好进行插入。不幸的是,这并没有帮助。列的宽度正在扩大而不会隐藏溢出。无论如何谢谢你试图帮助。干杯... – Marc 2012-02-24 23:54:40
你在测试什么浏览器?我会弹出一个虚拟机,然后看。 – Interrobang 2012-02-24 23:55:13
此外,为了澄清 - 你确定要取代所有的CSS?我更改了表中的属性,td:first-child和span.hide-overflow。 – Interrobang 2012-02-24 23:57:29