0
我想要使用div来实现类似下面的表格的相同结果,这样我可以使其响应并调整每个表格行的列数。 (例如,在第一行有3个响应列,然后在第二行有4个响应列)。我也想避免在单独的单词中写单个字div模拟的响应式列表
有没有办法做到这一点?
这里是当前表
<table>
<thead>
<tr>
<th class="short-column">Short Column</th> <!-- th sets the width -->
<th class="short-column">Short Column</th> <!-- th sets the width -->
<th class="long-column">Long Column</th> <!-- th sets the width -->
</tr>
</thead>
<tbody>
<tr>
<td class="lite-gray">Short Column</td> <!-- td inherits th width -->
<td class="lite-gray">Short Column</td> <!-- td inherits th width -->
<td class="gray">Long Column</td> <!-- td inherits th width -->
</tr>
</tbody>
</table>
table { table-layout: fixed; border-collapse: collapse; border-spacing: 0; width: 100%; }
.short-column { background: yellow; width: 30%; }
.long-column { background: lime; width: 40%; }
.lite-gray { background: #f2f2f2; }
.gray { background: #cccccc; }
是否有可能使用类似
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td>
<!--<div>THREE COLUMNS</div>-->
</td>
</tr>
<tr>
<td>
<!--<div>FOUR COLUMNS?</div>-->
</td>
</tr>
</table>
是这样的吗? http://jsfiddle.net/TdmkG/1/ –
是的,究竟需要什么。您能否在此发布代码,以便我可以接受您的答案,谢谢 – cMinor