You can do this, but for this you need to create a container so that it draws a special identifier:
#yourContainer div { padding-left:0px; } #yourContainer div > div { padding-left:5px; } #yourContainer div > div > div { padding-left:10px; }
HTML
<div id="yourContainer"> <div id="1" class='someclass'> contents <div id="2" class='someclass'> other contents <div id="3" class='someclass'> yet even more contents </div> </div> </div> </div>
If you want absolutly with class, try this
#yourContainer .someclass { padding-left:0px; } #yourContainer .someclass > .someclass { padding-left:5px; } #yourContainer .someclass > .someclass > .someclass { padding-left:10px; }
U may so, replace "padding-left" with "margin-left", it u the boss; -)
source share