php - 更改表格中某些行的颜色 - wordpress
问题描述
我有一个表,我想在其中使第 1、3、4 列填充这种颜色“#e1e1e1”。我该怎么做?
解决方案
查看 nth-child 选择器:http ://css-tricks.com/useful-nth-child-recipies
td:nth-child(1),
td:nth-child(3),
td:nth-child(4){
background-color: #e1e1e1;
}
<table>
<tbody>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
</tr>
</tbody>
</table>
推荐阅读
- c++ - using 指令如何以及在何处注入成员名称?
- python - python - 如何使用python对csv文件中的列使用if语句?
- python - 如何在 Dockerfile 中设置自定义 python 路径
- ios - 只能从它属于 Swift 的 Realm 中删除一个对象
- python - 隐式 RPM 问题:包中未明确包含的目录:
- javascript - 无法让 Firestore 规则让我阅读自己的文档
- mongodb - 多查询 Express/Mongodb
- vue.js - 如何在合成 api 中设置步骤形式?
- rfid - RFID 标签会话 2 持续多长时间?
- java - 是否可以根据子接口自动生成构造函数?(有或没有龙目岛)