【发布时间】:2016-12-22 17:59:54
【问题描述】:
我有一个 5 列的表,在移动设备上,它需要为每一行重复每个标题。
我在互联网上没有任何运气(可能是因为我使用了错误的词来搜索它“为每一行 html 重复表头”)...我找到了一个解决方案,但我已经丢失了,但是代码太多,太复杂而无法理解。我正在寻找一些关于我应该如何构建结构的建议/帮助,或者我可能需要做两个完全不同的标记?我也看到了一些插件,但我不被允许使用它们(我是初级职位,他们希望我自己思考如何解决问题)。
我不能提供很多信息....因为我真的不知道该怎么做,但我想这一定是一种不为每一行重复 html 标题的方法...对?
有什么帮助吗?
html:
<table class="myOrders col-xs-12" border="1">
<thead>
<tr class="headers col-xs-12">
<th class="col-sm-3 col-x-7">ORDER PLACED</th>
<th class="col-sm-2 col-x-7">ORDER ID</th>
<th class="col-sm-2 col-x-7">ORDER REF</th>
<th class="col-sm-3 col-x-7">ORDER AMOUNT</th>
<th class="col-sm-2 col-x-7">STATUS</th>
</tr>
</thead>
<tbody>
<tr class="order col-xs-12">
<td class="datePlaced col-sm-3 col-x-7"><span>2016-05-12</span><span>15.13.56</span></td>
<td class="ident col-sm-2 col-x-7">AW 1234-165</td>
<td class="ref col-sm-2 col-x-7">SMRF123</td>
<td class="amount col-sm-3 col-x-7">£23.33</td>
<td class="status col-sm-2 col-x-7">Pending</td>
</tr>
<tr class="order col-xs-12">
<td class="datePlaced col-sm-3 col-x-7"><span>2016-05-12</span><span>15.13.56</span></td>
<td class="ident col-sm-2 col-x-7">AW 1234-165</td>
<td class="ref col-sm-2 col-x-7">SMRF123</td>
<td class="amount col-sm-3 col-x-7">£23.33</td>
<td class="status col-sm-2 col-x-7">Pending</td>
</tr>
<tr class="order col-xs-12">
<td class="datePlaced col-sm-3 col-x-7"><span>2016-05-12</span><span>15.13.56</span></td>
<td class="ident col-sm-2 col-x-7">AW 1234-165</td>
<td class="ref col-sm-2 col-x-7">SMRF123</td>
<td class="amount col-sm-3 col-x-7">£23.33</td>
<td class="status col-sm-2 col-x-7">Pending</td>
</tr>
</tbody>
</table>
css:
table td[class*="col-"],
table th[class*="col-"] {
float: left;
}
【问题讨论】:
-
查看我的博客链接可能对你有帮助tadhanilalji.blogspot.in/2014/11/…
标签: html css html-table responsive