My div
sometimes starts with a p
a h2
a h3
or an ul
. Is there a way to select the first element of the div
, regardless of what the element is?
Here is a JSFiddle https://jsfiddle.net/nv0mg602/
In the first div I would like the the first p
to be red, not both p
. In the second div I would like the first h2
to be red.
Thanks everyone. I've realised that .main:first-child
doesn't work, but .main :first-child
does (with a space between main and the colon)