plainblack.com
Username Password
search
Bookmark and Share

    

multiple selectors

User elnino
Date 2/12/2010 9:27 pm
Views 554
Rating 0    Rate [
|
]
Previous · Next
User Message
elnino

If your div has multiple classes, how does one designate that in the css file?

<div class="wg-second-column wg-right">

vs

<div class="wg-second-column wg-left">

I would like to make a distinction between teh two divs above. But I guess if I have to make *another* unique class, I will, but it would be nice to take advantage of the combination of existing classes.

Thanks



Back to Top
Rate [
|
]
 
 
dionak

If you want to target a div that has both classes defined, you use double dot syntax. E.g. - .wg-second-column.wg-right (no spaces)

If you define this after the other class declarations, you'll inherit the previously defined CSS values.

Does this answer your question or did you have additional concerns?

Diona



Back to Top
Rate [
|
]
 
 
elnino

Cool!!  I couldn't find that google, what is that technique "called" so am able to google that again?

Thansk dionak!



Back to Top
Rate [
|
]
 
 
rogier

Multiple classes are very useful, however there is one problem: IE6 and lower doesn't understand this syntax (.classone.classtwo); it will only apply the last class (details).

You can still use it safely if you split up the statements, like we did in the layout.css stylesheet.

This article explains it well using a simple menu example and offers a IE6/IE5 workaround too: http://www.maxdesign.com.au/articles/multiple-classes/


Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Back to Top
Rate [
|
]
 
 
© 2012 Plain Black Corporation | All Rights Reserved