css - first child in multiple sub containers -


how abled select first, second , third span related layer 1, independent if first child of div @ layer 2?

<div class="layer1">   <div class="layer2">     <span>first<span>   </div>   <div class="layer2">     <span>second</span>     <span>third</span>   </div> </div> 

by using span:first-child first , second want first.

edit: i'm aiming making selection "get me first, second , third span children layer1". second , third in first layer2 div, , solution should not depend on that.

edit2: example @ http://jsfiddle.net/3haec/3/

selecting <span>first</span> works (assuming browser supports it)

.layer1 .layer2:first-child span {      // ... } 

as can see here: http://jsfiddle.net/3haec/


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -