Multiple classes in CSS Selector

Let’s say there’s a page with the following markup,

<div class="class1">
  <div class="class2">
    <div class="class3">
      Some page element(s).
    </div>
  </div>
</div>

The CSS you provided would style all elements under class3, which are under class2, which are under class1.

i.e. let’s say this was the styling,

.class1 .class2 .class3{
  color:red;
}

It would render the text as red, which is the equivalent of the following,

div.class1 div.class2 div.class3 {
  color:red;
}

Finally, the following would do nothing,

.class1.class2.class3{
  color:red;
}

Edit: If the markup instead was the following,

<div class="class1 class2 class3">
      Some page element(s).
</div>

It would work and render the text in red.

Note: < IE7 might have issues with the above…

http://www.thunderguy.com/semicolon/2005/05/16/multiple-class-selectors-in-internet-explorer/
http://www.w3.org/TR/2004/CR-CSS21-20040225/selector.html#class-html

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)