Previous Message
Next Message

Style rule based upon ID and Class?

Sent by Alys Morgan on 15 May 2005 11:11


>> Maybe a dumb question, but is it possible and if so, what would it 
>> look like
>> to write a style rule that is based upon the combination of an id and 
>> class
>> value on one tag?
>
>
> I do it all the time, but I think you have it a little backwards. 
> Since you shouldn't repeat ids (really, just don't), you should 
> include the common features in classes, then the unique styles in the id.
>
> So:
>
> <div class="explorer" id="mini">Mini</div>
> <div class="explorer" id="full">Full</div>

Or if neither of the sets of styles are unique, you can have:
<div class="explorer mini">Mini</div>
<div class="explorer full">Full</div>

Then you can have several divs with explorer and mini styles and several 
with explorer and full styles, without using an id more than once.

I know this works but I'm not sure what the general opinion is. Are 
there any problems with it? I have used it when I have several floats 
with most of the same styling, but some floated left and some floated 
right .

Thanks,

Alys

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: