how to write css for nth child in css

Posted by steven spielberg on Stack Overflow See other posts from Stack Overflow or by steven spielberg
Published on 2011-01-05T10:32:22Z Indexed on 2011/01/05 10:53 UTC
Read the original article Hit count: 355

Filed under:
|
<div id="boxcontent">

<div>some content this div may be missing [dynamic genrated]</div>

<div class="elem"></div>
<div class="elem"></div>
<div class="elem"></div>
</div>

<div id="boxcontent">


<div class="elem"></div>
<div class="elem"></div>
<div class="elem"></div>
</div>


<div id="boxcontent">


<div class="elem"></div>
<div class="elem"></div>
<div class="elem"></div>
</div>

i want to write some css on every 3rd div who have class .elem if i try nth-child to select them then sometime they select other.

How i can select 3rd .elem class div when parent div have some other div as child or not.

any way to select 3rd div who have class .elem

© Stack Overflow or respective owner

Related posts about html

Related posts about css