[wp-hackers] Styling of "post date"
Allan Mertner
amwp at mertner.com
Sat Sep 11 23:58:04 UTC 2004
Mike Little wrote:
>>It does, if you have more than one h2 tag inside the content - say,
>>inside a blog post. Adding a class specifier to allow the css to target
>>this element specifically would make sense: it adds readability to the
>>stylesheet and allows you to target your style to *that* element only.
>>
>>
>But then an h2 inside a post will be contained within a div of the
>class storycontent
>Thus
>#content div.storycontent h2 { color: blue;}
>will style the h2's within a post, again without changing the template.
>
>
This is obviously true, which is why I added the comment on
readability. IMO, this CSS is more readable, as in
easier-to-remember-what-it-does - and has no side effects:
.postdate {
color: blue;
}
than this:
#content h2 {
color: red;
}
#content div.storycontent h2 {
color: black; // or whatever the default is. Remember to change it
in both places.
}
I can work around it by hacking index.php or by adding what I would
consider unnecessarily obscure statements to my stylesheet. I'd prefer
it if I didn't have to do either, but it's of course not my call.
Allan
More information about the hackers
mailing list