5 replies [Last post]
Ludovick
Offline
newbie
Last seen: 8 years 7 weeks ago
Joined: 2006-06-04
Posts: 6
Points: 0

Hello folks!

just a question: is there any way to assign 2 classes to the same div? I know, it's possible to assign id and class, but 2 classes at a time could open killer possibilities...

thanks in advance.

Anonymous
Anonymous's picture
Guru

Re: 2 classes to 1 div ?

<div class="class1 class2"></div>

There you go. Enjoy. I really don't find it that useful.

Ludovick
Offline
newbie
Last seen: 8 years 7 weeks ago
Joined: 2006-06-04
Posts: 6
Points: 0

2 classes to 1 div ?

yep, that works, thanks!

this adds a lot indeed. for example, when you need to have same styled and colored layer to be different width - you use 3 classes - one for styles-colors, 2 more for different widths. all in all, this is less code than writing 2 big classes with different widths.

Anonymous
Anonymous's picture
Guru

2 classes to 1 div ?

Ludovick wrote:
... all in all, this is less code than writing 2 big classes with different widths.
Maybe. Smile

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 1 week 3 days ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Re: 2 classes to 1 div ?

Triumph wrote:
<div class="class1 class2"></div>

There you go. Enjoy. I really don't find it that useful.
It's useful for things like adding Tony's clearfix class to an already styled element.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

Anonymous
Anonymous's picture
Guru

Re: 2 classes to 1 div ?

Tyssen wrote:
It's useful for things like adding Tony's clearfix class to an already styled element.
Ah, true.