Sent by Dave Silvester on 29 October 2004 10:10
On Friday 29 Oct 2004 02:07, Matt Andrews wrote:
> nice suggestion, Dave, and i would also point out the option of using
> multiple classes:
>
> <p class="accent_dark contrast">This paragraph will get the foreground
> colour from the "accent_light" class, and the background from the
> "contrast" class.</p>
[snip]
> in this way you could define your colours or colour combinations as
> individual classes, and apply them to elements as you wish.
Although you'd have to change the CSS I provided, since all apart from
div.pull were setting color, not background-color.
So in the case that you specified, for example:
<p class="accent_dark accent_light">Uh-oh, I've specified two classes that
both try to set the color of the text!</p>
I believe what would happen, since neither one has a greater specificity, is
that the last one specified (accent_light) would be the one that overrides,
since obviously you can't set the color to two different values
simultaneously!
However, if this was your CSS:
.accent_light {
color: #ffffff;
}
.accent_dark {
background-color: #000000;
}
Then the above snippet would work fine, and you'd end up with white text over
a black background, that could also be use independently of each other if you
so desired. Obviously this can be expanded upon to do more exciting
stuff! :-D
> if you abstract and combine style rules, the concept of multiple classes is
> very powerful and useful.
Indeed it is, yet another reason why CSS is great!
~Dave
--
Dave Silvester
Music Technology Junkie
Web: http://www.mu-sly.co.uk/
Email: sly at mu hyphen sly dot co dot uk
______________________________________________________________________
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/