我有一张桌子
<td colspan="6">
<table width="100%" border="0">
<tr align="center">
<td width="5%"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></td>
<td width="7%"><strong>Item Id </strong></td>
<td width="20%"><strong>Item</strong></td>
<td width="17%"><strong>Type</strong></td>
<td width="17%"><strong>Rate</strong></td>
<td width="17%"><strong>Quantity</strong></td>
<td width="17%"><strong>Price</strong></td>
</tr>
我通过这样的<DIV>
代表桌子
<div id="table">
<div class="row" id="row" align="center">
<div id="cell"><input type="checkbox" name="chkAll" class="chkAll" value="1" /></div>
<div id="cell"><strong>Item Id </strong></div>
<div id="cell"><strong>Item</strong></div>
<div id="cell"><strong>Type</strong></div>
<div id="cell"><strong>Rate</strong></div>
<div id="cell"><strong>Quantity</strong></div>
<div id="cell"><strong>Price</strong></div>
</div>
但我找不到任何替代品来替代colspan="6"
.谁能帮忙?
好的,让我们第 100 次直截了当。
桌子不是邪恶的。
表用于表格数据。如果您有标题、行或列,那就很酷了。桌子是要使用的东西。
在 HTML 中。表。
滥用元素是邪恶的
出于错误的原因使用任何元素都是错误的。
图像h1
布局table
链接button
这些事情是错误的。而且不好。
总结
将表格用于表格,而不是用于布局,每个人都会很高兴。
Div 不使用列的概念。您可以拥有任意数量的div。您可以固定div的宽度,然后可以使用它们来构建表格。顺便说一下,你可以选择像bootstrap这样的css框架会更有效率。
使div 宽度达到这样一种方式,它将占据"TD"部分。
为此,您只需要在新行上再添加一个宽度较高的类,而div 则更少。