我有以下布局。
<style>
table { width: 200px; white-space: nowrap; table-layout: fixed; }
.a { width:10px; overflow: hidden; text-overflow: ellipsis }
.b { width:190px; overflow: hidden; text-overflow: ellipsis }
</style>
<table border="1" style="">
<tr>
<td colspan="2">Some content header goes in here</td>
</tr>
<tr>
<td class="a">This cells has more content</td>
<td class="b">Less content here</td>
</tr>
</table>
我想设置一个固定的表格布局,并且每列都有固定的宽度,但是由于我在固定列上方使用了 colspan
,所以我无法设置宽度。我该如何实现这一点?
<col>
和<colgroup>
在HTML4和HTML5中仍然有效,但是<col>
上的许多属性(例如<col align="">
)在HTML4中已被弃用,并在HTML5中变得过时。尽管如此,上述语法在HTML4和HTML5中都是有效的。请参见MDN,HTML5规范,HTML 4.01规范。 - Jonathan S.