Please say there's a simpler/shorter way to write this CSS:
.ads h3{
color: #f7f7f7;
}
.ads p{
color: #f7f7f7;
}
.ads blockquote{
color: #f7f7f7;
}
It's a right pain at the moment and takes up space in the CSS file...
You can group selectors that you wish to share common rules by separating them with commas. So, the following will work:
.ads h3, .ads p, .ads blockquote {
color: #f7f7f7;
}
See the CSS 2.1 Specification, Section 5.2.1.
"Your prayers have been answered my child"
.ads h3, .ads p, .ads blockquote {
color: #F7F7F7;
}
And even taking it further (if there are no child elements which should not be colored as well):
.ads * {
color: #F7F7F7;
}
And if you're OK with the text inside the paragraph itself to also have this same gray color:
.ads {
color: #f7f7f7;
}
This will be overridden by any other styles that have been set on p, blockquote or h3, so you might want to take it further:
.ads, .ads * {
color: #f7f7f7;
}
.ads * will still be overridden by .ads h3 (and others), so it'll be useless. The universal selector * holds no value in terms of specificity. In other words, .ads * is specifically equivalent to .ads..ads * overrides h3 because class is more specific than element so it wins out. If you change h3 to .ads h3 it overrides .ads *. See jsfiddle.net/JNPXm.ads * will get overridden by h3. sorry my bad. But you said two wrong things.. ".ads * is specifically equivelent to .ads" - that's not right because .ads * will color only the element inside of it, not the text within .ads, and you said that "* holds no value in terms of specifity" which is also not true.Unless there are any other overriding rules you haven't shown, this will be fine:
.ads
{
color: #f7f7f7;
}
.ads then this is fine. +1You don't need the trailing ; either (per YUI CSS Min)
.ads h3,.ads p,.ads blockquote{color:#f7f7f7}