tags:

views:

37

answers:

2

.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.

When 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

+1  A: 

It's not possible in raw CSS.

You may want to take a look at CSS preprocessors like SASS or LESS

ChssPly76
I wouldn't know how to apply SASS for typical setups like my own where I use apache/linux (no rails).
Joe
@Joe - neither SASS nor LESS are tied to rails or ruby at runtime. You do need to have ruby to process the stylesheet (though for LESS there's a PHP port: http://leafo.net/lessphp/docs/) but once preprocessed they become regular CSS files.
ChssPly76
I was just about to do it using PHP and save a cached css file, however it looks like this is already done for me with that port. Great!
Joe
+1  A: 

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.'

Kevin