Combining classes with CSS

Jimmy Ghaphery jsghaphe at vcu.edu
Wed Mar 13 16:35:09 EST 2002


CSS gurus,

What's the prevailing temperature on referencing more than one CSS class
at the same time.
Is this legal? Ill-advised?

Example. Let's say I have several classes like:

.emphasis1{ color: red; background-color: #FFFFFF;}
.bold{ font-weight: bold;}
.marginmedium{ margin-left: 2em; margin-right: 2em;}

Can I mix and match these in the html like
p class="emphasis1 marginmedium"
or 
p class="bold emphasis1"
or the whole enchilada
p class="emphasis1 marginmedium bold"

This seems to be working for me across later versions of IE, Netscape,
and Mozilla. It also seems to be easier than trying to come up with
specific combinations as separate classes like 
.empahsis1_bold{ color: red; background-color: #FFFFFF; font-weight:
bold}

thanks in advance for your help and patience,

Jimmy Ghaphery
VCU Libraries



More information about the Web4lib mailing list