Sorry if the title is complicated, but that pretty much describes it.
Lets say I have two CSS classes: .class1 and .class2. What .class2 does is irrelevant, however, if .class2 is wrapping a div that has .class1, I need it to be a different colour then if it was alone.
For example:
<div class='class1'>
  I should have a red background!
</div>
<div class='class1'>
   <div class='class2'>
     I should have a blue background!
   </div>
  I still should have a blue background!
</div>
Stylesheet:
.class1 {
  background-color: red;
}
.class2 {
  /*Contents are irrelevant*/
}
 
     
     
    