CSS Question - Any way to set (eg. a font-size) to a group of styles, by linking the style to another?
.small_fonts{ font-size:10px; }
.fonts_blue{ color:blue; } .fonts_red{ color:red; } .fonts_green{ color:green; }
Any way to apply "small_fonts" to each of the "fonts_blue, _red, _green" w/o doing this:
.fonts_blue, fonts_red, fonts_green { font-size:10px; }
I am just trying to update my css to be more organized. I realised I don't need to define the font-size for each of the "small" fonts.
W开发者_Go百科hen adding the class btw... I know you can do this: class="small_fonts fonts_blue" ~ however I'm talking about combining within the css stylesheet
It's not possible in raw CSS.
You may want to take a look at CSS preprocessors like SASS or LESS
SASS may be able to achieve this:
http://sass-lang.com/
'Sass is a meta-language on top of CSS that’s used to describe the style of a document cleanly and structurally, with more power than flat CSS allows. Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.'
精彩评论