CSS question
- Started
- Last post
- 8 Responses
- ukit
I've found using multiple class selectors in my stylesheets can be pretty useful, as in:
classname.classname {
}
Unfortunately, (big surprise) IE6 doesn't seem to support this. Is there any trick to get this to work in IE6?
- nocomply0
i don't know about getting something like "classname.classname" to work, but IE6 should handle an element given multiple classes no problem.
for example....
div class="class1 class2"
- tbgd0
multiple classes work in IE6. you've just got the syntax (is that the right word for it?) wrong. don't put in the full stop just a space.
e.g. "className className"
- tbgd0
sorry nocomply i didn't read your reply properly. i've just repeated what you said.
- ukit0
Sure, but I'm talking about syntax in the stylesheet rather than in the HTML. So the HTML would be:
class="classname classname"
and the stylesheet would be:
classname.classname {
style
}to indicate styles for that combination of classes only.
This is handy in IE7 and FF from a dev point of view because you can append a generic class to a div, like
class="nav_home on"
Just wondering if there's away to get it or something similar to work in IE6.
- acescence0
shouldn't it be
.classname.classname {}
not
classname.classname {}
??
- ukit0
Oops - yeah, that was just a typo on my part.
- abba_cadaver0
Should it be
.classname, .classname {}
- monNom0
it shold be ...
.classname .classname {}
...to use inheritance (note the space)
just like ...
.classname a {}
..deals only with anchor tags within a container of 'classname' class.
to apply multiple classes to one element you put class="classname1 classname2 classname3"