[WEB4LIB] Re: Can an element have two class attributes?

Jeph Remley jremley at lms.kent.edu
Tue Apr 19 09:03:40 EDT 2005


I seem to have lost the original msg on this thread - sorry.

Yes, you can do the following:

<div class="reason1 reason2">Text to be hidden or displayed</div>

Just put a space between the two class names.  I've always done this 
where they were complementary to each other and I KNEW what I wanted 
from each would work well together.  (like <div class="rowOdd newEntry"> 
if I remember correctly?)  I've never set up ones that would conflict, 
so I'm not sure who would win out...I would guess the latter of the two 
based on the CASCADING aspect of CSS, but I don't know.

Jeph Remley
Systems Dept
Libraries & Media Services
Kent State University
Kent OH 44242

(330) 672 3090
jremley at lms.kent.edu
http://www.library.kent.edu


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? You might need a Javascript event handler to capture the
> triggering event and then perhaps some more JS to perform the desired
> action. It really depends on what you're trying to do--what is the trigger
> and what are the actions?
> 
> 



More information about the Web4lib mailing list