sra*_*put 2 css css-selectors pseudo-class
CSS标记的pseudo类选择器(第一个孩子)适用于作为其父代的直接第一个孩子的所有p,为什么不适用于作为p本身的第一个直接元素的p标记。
p:first-child {
color: blue;
}Run Code Online (Sandbox Code Playgroud)
<body>
<p>This P is body's first Child.</p>
<p>This is body's second child.</p>
<div>
<p> This P is div's first Child </p>
<p> This is div's second child.</p>
</div>
<p>
<p> This P is P's first child :: Why it does not get pseudo class</p>
<p> This is P's second child </p>
</p>
</body>Run Code Online (Sandbox Code Playgroud)