|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
avoiding repetions in defining css classes
Hi to all, & this is my question:
say I have a css class such as: .classA1 { color: RED; font-weight: bold; font-size: 11px } Now I want to define other classes, that vary only in the font color, while everything else remains unchanged, for example: .classA2 = { color: GREEN; rest same as A1 } .classA3 = { color: BLUE; rest same as A1 } .classA4 = { color: YELLOW; rest same as A1 } How do I go about it, so I avoid having to repeat every time the same attributes? I know there is a way of defining a main class & then the variations (like for elements - a - a:hover - a:visited etc..) but I'm not sure how you do this... Thanks a lot for your help, Luca |
|
#2
|
||||
|
||||
|
.classA1, .classA2, .classA3, .classA4 { font-weight: bold; font-size: 11px }
.classA1 { color: RED;} .classA2 { color: GREEN;} .classA3 { color: BLUE; } .classA4 { color: YELLOW;} like this, with using the comma , to seperate the classes. for the other .main a:link { font-weight:bold; } will affect all links within the element with the class .main http://www.w3.org/TR/CSS21/selector.html |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > avoiding repetions in defining css classes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|