...

View Full Version : Multiple Font Classes



mark87
03-14-2005, 04:06 PM
Just wondering... say I want to have two different styles to text on a page - I'll say for this example - bold and standard. Now the only thing I want to be different between the two types of text is the font weight... so how do I do that without specifying the other attributes again? eg.

<style type="text/css">
p.textstylenormal {
text-align: center;
font-family: verdana;
font-size: medium;
color: #ffffff
}

p.textstylebold {
text-align: center;
font-weight: bold;
font-family: verdana;
font-size: medium;
color: #ffffff
}
</style>

cbouchar
03-14-2005, 04:21 PM
You can specify attributes to a group of elements and then add/change attributes to each element individually afterwards. That way, you don't have to repeat the same attributes over and over again.



<style type="text/css">
p.textstylenormal, p.textstylebold{
text-align: center;
font-family: verdana;
font-size: medium;
color: #ffffff
}

p.textstylebold {
font-weight: bold
}
</style>

mark87
03-14-2005, 04:35 PM
Ah thanks, yup that's what I wanted. :)

Graft-Creative
03-14-2005, 08:36 PM
I'd do this: Set your standard font rules in the body tag - then apply the class to the exceptions, as below -



body {
text-align: center;
font-family: verdana;
font-size: medium;
color: #ffffff
}

p.textstylebold {
font-weight: bold;
}


Kind Regards,

Gary



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum