Sunday, December 9, 2012

CSS Selectors POC

p > div : mean select all div's where parent is p
p + div : Select a div where immediate parent is p

I have two divs :
<div id="div1" class="class1 class2">
</div>

<div id="div2" class="class1">
</div>
can the css class be applied to just divs which are styled with class1 and if they contain class2 then its ignored ? So in above divs just div2 is styled with class1 because div1 is also styled with class2.

.class1{
  background:red;
}
.class1.class2{
  background:none;
}
or .class2.class1{
 background:none;
}

No comments: