how to write css for nth child in css
- by steven spielberg
<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