Is there a way, for example, to specify css code for the 5th .slide element as follows:
HTML
<div id="slides"> <section> <div class='slide'></div> this should be 1 <div class='slide'></div> this should be 2 <div class='slide'></div> this should be 3 </section> <section> <div class='slide'></div> this should be 4 </section> <section> <div class='slide'></div> this should be 5 I target this one <div class='slide'></div> this should be 6 <div class='slide'></div> this should be 7 </section> </div>
CSS
.slide:nth-of-type(5) { background:red; }
I thought something like this would work, but it is not.
I basically want to get each item with the corresponding number, so the 7th with a seven in css
I am open to jquery solutions if necessary
source share