Why does the W3C not like phrase tags?
Mar. 24th, 2009 11:28 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
The <em>, <strong>, <dfn>, <code>, <samp>, <kbd>, <var>, and <cite> tags are all phrase tags. They are not deprecated, but it is possible to achieve richer effect with CSS.
This sort of remark is pretty common on the W3C website. I’ve never been able to figure out why. As far as I’m concerned, the value of phrase tags
is concise markup. Certainly, I can use <span class="citation">Foo</span> to achieve the same effect as <cite>Foo</cite>, but it involves a lot more typing, and while I’m editing my source, it makes a lot less sense. Additionally, tags may represent semantic meaning, while classes are tied to presentation; I could easily harvest all the citations from a page if they are all marked with <cite>.
I also don’t see how it is possible to achieve richer effect with CSS
, because I can attach CSS rules to phrase tags every bit as easily as I can attach them to classes, and sometimes I find it much easier, because I can further decorate the phrase tags with CSS classes:
/* With just a class */
.citation {
font-style: italic;
}/* With a phrase tag */
cite {
font-style: italic;
}/* With phrase tags and classes */
cite {
font-style: italic;
color: #DDDDDD;
}
cite.good_book {
font-weight: bolder;
}
cite.bad_book {
font-style: normal;
font-size: smaller;
}
Of course it’s a somewhat contrived example (I’m sure a better one can be made); the point is, I use a CSS rule to override the rule on the tag with a more specific one. To the best of my knowledge, I can’t combine classes in this sense, and if I want to use overrides, I either have to rely on the order of rules in stylesheets (ew), or use !important declarations (ew)—all this while losing semantic coherency and creating more of a typing job for myself; and while the styling benefits may not be huge, they appear to be real, with no apparent drawbacks.
So why on Earth should I heed the W3C and think that it is possible to achieve richer effect with CSS
?
no subject
Date: 2009-04-02 07:08 am (UTC)