这听起来很简单,但我找不到关于它的许多帖子。基本上,我想要第一列红色,第二列绿色,第三列红色等等... 我该如何在CSS中实现这个呢?这是我的HTML代码(我正在使用Bootstrap 3):
<table class="table table-striped">
<thead>
<tr>
<th>Welsh</th>
<th>English</th>
</tr>
</thead>
<tbody>
<tr>
<td>Shwmae <a href="#" onclick="playAudio('shwmae');"><span class="glyphicon glyphicon-volume-up play"></span></a></td>
<td>Hello</td>
</tr>
<tr>
<td>Bore da <a href="#" onclick="playAudio('boreda');"><span class="glyphicon glyphicon-volume-up play"></span></a></td>
<td>Good morning</td>
</tr>
<tr>
</tbody>
</table>
我尝试使用以下CSS,但它没有起作用:
col:first-child {background: #FF0}
col:nth-child(2n+3) {background: #CCC}