The h1:first-child
selector means
Select the first child of its parent
if and only if it's an h1
element.
The :first-child
of the container here is the ul
, and as such cannot satisfy h1:first-child
.
There is CSS3's :first-of-type
for your case:
.detail_container h1:first-of-type
{
color: blue;
}
But with browser compatibility woes and whatnot, you're better off giving the first h1
a class, then targeting that class:
.detail_container h1.first
{
color: blue;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…