我正在使用 Bootstrap css 库。我知道如何用这个库制作条纹表,但如何制作条纹 div?
例如,在表中你会这样做:
<table id="newtable" class="table table-bordered table-striped fixedtable">
<thead>
<th>Date</th>
<th>Info</th>
<th>Price</th>
</thead>
<tbody>
<tr>
<td colspan="3">
<div>text 1</div>
<div>text 2</div>
<div>text 3</div>
<div>text 4</div>
</td>
</tr>
</tbody>
</table>
我需要像这样用 div 重复这种“样式”:
<div class="row"><div class="col">Text 1 White BG</div></div>
<div class="row"><div class="col">Text 2 Grey BG</div></div>
<div class="row"><div class="col">Text 3 White BG</div></div>
<div class="row"><div class="col">Text 4 Grey BG</div></div>
问题是:如何制作: <div>text 1</div>, <div>text 2</div>, <div>text 3</div>, <div>text 4</div>
条纹?
原文由 Lugaru 发布,翻译遵循 CC BY-SA 4.0 许可协议
Twitter Bootstrap 的条带化仅适用于表格行。因此,为了对您的 div 进行条带化,您需要将它们中的每一个添加到一个新行中。例如:
另外我不确定你想用
colspan="3"
实现什么。如果你想创建一个合适的表,你需要为每一列创建新的td
。例如: