[WEB4LIB] Re: Can an element have two class attributes?
Thomas Dowling
tdowling at ohiolink.edu
Tue Apr 19 09:03:07 EDT 2005
Randy Norwood wrote:
> I don't think that's allowed within one element. Besides, how would that
> work? How would the browser determine which class to apply in a particular
> page request?
It is allowed: the class attribute "assigns a class name or set of class
names to an element...Multiple class names must be separated by white
space characters."
<http://www.w3.org/TR/html4/struct/global.html#adef-class>
Browsers figure out what styles to use by applying the normal cascade.
In '<div class="foo bar">' the foo and bar classes have equal priority,
so in the case of a conflict the browser should use the property defined
last--bar would trump foo in this case. Seems to be correctly supported
in IE6 and Firefox (natch!).
[Very sensible information about Javascript snipped.]
--
Thomas Dowling
tdowling at ohiolink.edu
More information about the Web4lib
mailing list