May 12, 2005

Repeating CSS Class Specifications

One of the problems with CSS is in specifying elements that you'd like repeated in multiple classes — for instance, a color. Changing that color means you've got to change instances of that color.

I came across this post about coding CSS so that you can specify a color (or anything else) once: Quick CSS color schemes.

Of course, this seems to require that you use both an id and a class in your HTML. What I'd like is a way to specify in the CSS file elements (e.g., colors) that can be referenced for classes and elements lower in the file. Making up some code to illustrate:

.acolor {color:#ff0000;}

h1 {+.acolor; font-size:20;}

I mean, talk about speedy CSS design; it's not a terrible thing to ask. But if such a thing were ever implemented, who knows what year any browsers (let alone all then-current browsers) would implement it?

Have your say ...

First-time comments will be held for moderation (but comments are appreciated). Otherwise, just be courteous. If your name is a bunch of keywords, your comment will be deleted. Don't post links unless highly pertinent. Posters must be 16 or older.

Manage your subscriptions

© 2004-2017 DianeV Web Design Studio. All Rights Reserved.
33 queries. 0.225 seconds.