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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -