View Full Version : setting two values to the class attribute

09-22-2004, 03:38 AM
Simple really, I'd like an element to have two class values.
I tried this:

<a href="#" class="class1" class="class2">link</a>

but it doesn't validate (and for obvious reasons).

So is my only solution to create a third class that combines the two?

Thanks :)

09-22-2004, 03:52 AM
Separate classes with a space and you are cookin' with gas.

.class1 { background: #fff; }
.class2 { font-family: arial,sans-serif; }
.class3 { color: #000; }


<div class="class1 class2 class3">

09-29-2004, 04:31 AM
ohhhhhhh, thanks much.