html - Apply CSS to an element that belongs to two classes but not those two classes individually -
is possible: have div belongs 2 classes , want add more config div dont want parent classes individually have properties. e.g.
div-one
<div class="classa classb">some text</div>
div-two
<div class="classa"></div>
div-three
<div class="classb"></div>
now in css file:
.classa{ height:100%, width:100% } classb{ text-align:center, etc:etc }
now how apply additional config div-one without adding config options classes & b , cannot use id property because div gets created dynamically. want functionality
.classa .classb{ //additional config }
but dont want additional config applied div-two , div-three
if i'm understanding question correctly, want style div
has both classa
, classb
correct? if so, here how that:
.classa.classb { //additional config }
note how there no space between 2 classes. means styles set applied elements have both classa
, classb
here fiddle showing off: http://jsfiddle.net/nbj2j/
Comments
Post a Comment