Ok, so I've got a little trouble here, I'm creating a div
that'll be the child of another div
and will be the parent of
•ul
,
•obviously li
&
p
elements
my trouble is that I need to style every first child
starting with the first div
, I know that :first-child
pseudo-class will make the trick, 'cause I've used it too much, given this markup fragment
div>ul,
p:first-child {
border: 4px solid red;
}
<div>
<div>
<ul>
<ul>
<li>
<p>Item 1</p>
<p>Item 2</p>
</li>
<li></li>
<li></li>
<p>Yesterday</p>
<p>Today</p>
<li></li>
<li>
</li>
<li>
</li>
<li>
<p>Item 3</p>
</li>
<li>
<p>Item 4</p>
</li>
</ul>
</ul>
</div>
</div>
I can't really understand why Chrome DevTools apply the styles but grays me out the p:first child
selector in the console, as seen in this image