I have been looking at the w3 page on css selectors and have not found any promising leads, so I thought I would ask...
Is there a way to style a single element with two classes differently than if it was one class?
Example:
<a class="foo">Red</a> <a class="bar">Yellow</a> <a class="foo bar">Orange</a> a.foo { color:red; } a.bar { color:yellow; } a.foo.bar { color:orange; }
HTML elements can be assigned multiple classes by listing the classes in the class attribute, with a blank space to separate them.
While an element can only have a single ID attribute, you can give an element several classes and, in some cases, doing so will make your page easier to style and much more flexible. If you need to assign several classes to an element, add the additional classes and simply separate them with a space in your attribute.
To specify multiple classes, separate the class names with a space, e.g. <span class="left important">. This allows you to combine several CSS classes for one HTML element.
You just answered yourself. Be wary of the IE6 bug.
Yeah dude, you have just answered it yourself. Have a quick scan on these two pages -
Hope that helps :)
Nick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With