css: simple thing never known answer to; how to say if element is this class as well as that class?

You mean 'IF <a> has a class of recentAlt AND a class of c THEN apply new styling rules'?

You can't. At least not with CSS alone.
 
Last edited:
a.recentAlt { style }
a.c { style }
a.recentAlt.c { style }

What's wrong with this?

edit: beaten to it
 
genius! always hated not knowing the answer to this so really appreciate the help. my mistake was to leave a gap between recentAlt and c
No problem.


Right, that's it. I'm taking up pig farming.
I wouldn't feel bad, It may be simple and kind of common sense once you know about it, but I don't think it's actually that well known as it wasn't really viable to use when aiming for IE6 compatibility. Now that IE6 doesn't matter so much though, it's handy to know.
 
I wouldn't feel bad, It may be simple and kind of common sense once you know about it, but I don't think it's actually that well known as it wasn't really viable to use when aiming for IE6 compatibility. Now that IE6 doesn't matter so much though, it's handy to know.

That is true, I haven't read a CSS tutorial for some time, but I don't remember seeing it explain multiple selectors, or child selectors, or adjacent selectors. They are nicely documented in the W3C spec though.

The holy grail of selector information: http://www.w3.org/TR/CSS2/selector.html
 
Back
Top Bottom