Gorna-Bania Gorna-Bania - 1 month ago 9
CSS Question

CSS: Select the first div with tag itemprop

I have the following structure:

<div id="wrapper">
<div></div>
<div></div>
<div itemprop="description"></div>
</div>
<div itemprop="description"></div>
<div></div>
<div></div>


How to select only the first div with itemprops=description?
Or how to select the 3rd div inside #wrapper div?

Answer

For this specific case:

#wrapper > div:nth-child(3)

Though if the markup is likely to change, a better option would be to use a class or id, if possible.