-1

是否可以仅通过 CSS 从此 HTML 块中选择以下内容?或者选择除我想要选择的内容之外的所有内容?

<dl>
<dt>dt one</dt>
<dd>dd one A</dt>
<dt>dt two</dt>
<dd>choose this dd and only this dd</dd>
<dd>dd two B</dd>
<dt>dt three</dt>
<dd>dd three A</dd>
</dl>
4

2 回答 2

2

听起来要么dd:nth-child(4)或者会给你那个元素,除非你的问题dd:nth-of-type(2)根本没有提到一些条件(它在当前形式下看似简单)。

于 2012-11-12T04:22:13.160 回答
0

是的。W3Schools 有一个很好的资源:http ://www.w3schools.com/cssref/css_selectors.asp

您可能会发现特别感兴趣的第 n 个子选择器。

于 2012-11-12T02:11:42.783 回答