比如说我有这样的表格布局
<table>
<tr>
<td id="AEimage1">
row 1 cell 1
</td>
<td id="AEimage2">
row 1 cell 2
</td>
</tr>
<tr>
<td id="setup1">
row 2 cell 1
</td>
<td>
row 2 cell 2
</td>
<td>
row 2 cell 3
</td>
<td>
row 2 cell 4
</td>
</tr>
</table>
如何调用 CSS 中的单个行和单元格?所以说我想调用 [Row2, cell 1],我该怎么做?我试过像下面这样在 CSS 中堆叠元素:
#LinkCSS table tr tr td {
但这对我不起作用。我做错了什么?
(请注意,我意识到我可以为单元格提供 ID,并以这种方式调用它们。但这对我不起作用)。
最佳答案
您可以像这样使用 :nth-child
选择器和 :first-child
选择器:
table tr:nth-child(2) td:first-child {
color:red;
}
Demo.
关于html - 引用表元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23170265/