我有这个代码:
<html>
<head>
<style type="text/css">
* > ul li:nth-child(4n+3) { color: red; }
</style>
</head>
<body>
<ul>
<li id="A" class="u">1</li>
<li>
<ol>
<li id="B" class="u">2.1</li>
<li id="C" class="g">2.2</li>
<li id="D" class="u">2.3</li>
<li id="E" class="g">2.4</li>
</ol>
</li>
<li id="F" class="u">3</li>
</ul>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在这它选择2.3,3但我不明白这是如何发生的.
我的想法是:它同时选择相对于父元素的奇数位置的两个元素.但2.3真的是第3位还是7位呢?我真的被卡住了,请帮忙.