也许我找错人了。我有一个包含 6 列的表格,每个列中都有一个有序列表。我希望它们除了第一个列表外都具有边框。
The site is in development here基本上虽然 html 是
<tr>
<td>
<ol>
<li>hello</li>
</ol>
</td>
<td>
<ol>
<li>hello</li>
</ol>
</td>
<td>
<ol>
<li>hello</li>
</ol>
</td>
</tr>
我以为 tr 的第一个 child 会这样工作 tr:first-child ol {style}
最佳答案
:first-child
选择器是 CSS2,在 IE6 上不受支持。如果 IE6 很重要,那么您需要为第一个 child 提供一个您可以选择的类(class)。但正确的语法是:
tr td:first-child ol { ... }
当你这样做时:
tr:first-child ...
您实际上选择了 <tr>
是第一个 child 的元素。另请注意:
tr :first-child ...
正在选择第一个 表行的 child 。
关于css - 选择表中的第一个列表 - CSS first-child?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2197133/