This one has to be the most basic question but it's not clear in my mind, so I'd like to ask it:
Say you have some basic HTML like this:
<div class="a">
<p class="b">something</p>
<img class="b">
<p class="c">something</p>
</div>
How can you select the first <p>
element using CSS?
The reason why I'm puzzled that up till now I believed that CSS can work by both specifying type and class, but it seems I cannot do it. So I can have something like: div p
or div .b
or .a p
or .a .b
but not div .a p .b
as I was believing and as how every browser tool names the elements (like div.a p.b
)
Is all this issue because of the space between the class and the type?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…