Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS difine a class with another class

Status
Not open for further replies.

irate

Programmer
Jan 29, 2001
92
0
0
GB
Is it possible to create a class that is simply one or more other classes with added attribures.

Eg.

If I had the following classes in a generic style sheet:
Code:
.bgcBlack                { background-color: #000000; }
.fgcWhite                { color:            #FFFFFF; }
.ffMonospace             { font-family:    monospace; }
and then on a particular HTML page I wanted a class that combined the above classes and made the font size 20px, I know I COULD do the following:
Code:
<span class=&quot;bcgBlack fgcWhite ffMonospace&quot; style=&quot;font-size:20px;&quot;>
 this is the text
</span>
but I would prefer to create a new class something along the lines of:
Code:
.newClass             {bcgBlack;fgcWhite;ffMonospace;font-size:20px;}

So, is this possible, and if so what is the syntax.
Thanks in advance.
 
I think the best you could do would be:
Code:
.bgcBlack, .newClass    { background-color: #000000; }
.fgcWhite, .newClass    { color: #FFFFFF; }
.ffMonospace, .newClass { font-family: monospace; }
.newClass               {font-size: 20px;}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top