.class + p:first-child{
}
the above code not working, unless it's element instead of class, like p:first-child.
<div class="wrap">
<h3></h3>
<div style="clear:both"></div>
<p></p>
<p></p>
<p></p>
<p></p>
how do I select first p
base on the class wrap? I do not want to apply class name on p
.
BoltClock
728k165 gold badges1.4k silver badges1.4k bronze badges
asked Dec 19, 2013 at 5:29
1 Answer 1
You can't use :first-child
here, because in this case first-child
of class:wrap
is <h3>
.In your desired case try this
.wrap > p:nth-of-type(1) {
color:red
}
Fiddle is HERE
answered Dec 19, 2013 at 5:52
Comments
default