Tue 4 May 2004
- Semantic
- adj : of or relating to the study of meaning and changes of meaning;
Source: Dictionary.com
Do as I say, not as I do…
HTML is a language for describing content. It is not for display. I accept that it has its limitations in terms of how it is used for display. However, correct semantic markup will is better for your users and you.
Despite the widespread replacement of <b> and <i> with <strong> and <em> Matthew Thomas gives some examples of the uses of semantic code offers some advice:
if you want to use bold or italics, and HTML doesn’t have a semantic element for what you mean, use
bori. If you’re not sure which semantic element to use, usebori. And if you’re creating an authoring tool for people who won’t know or care about semantics, please leave the semantic markup alone, and just stick tobandi
While the simplicity of this appeals to me, and the practicality can’t be denied, I still don’t feel comfortable working this way.
If I really don’t know what is semantically correct (and couldn’t find a suitable answer) I’d use a <span class="whatever"> (or perhaps an id instead of class)
I think that this is better as you can then define its display using stylesheets. <span> has the advantage of being a generic inline container with no sematic meaning itself (i.e. you can use it to influence the display, without affecting the semantics of a document).
Dan Cederholm’s SimpleQuiz is a great resource and generates great discussion about semantics
How is
<span class="whatever">an improvement over<i class="whatever">? I used the latter. They’re equally stylable. They’re equally presentational. The only difference is thatiwill work in Lynx and other non-CSS browsers, andspanwon’t.Hi Matthew,
According to About.com
<i>has been deprecated in HTML 4 and XHTML 1 (which is the reason I would prefer to not use it). However, I have not been able to find it on the W3C site, in which case you are correct. I learn something new every dayOn further research, it appears that
<i>(and<b>) has been removed from the working draft of XHTML 2Elements deprecated in HTML 4.01:
applet,basefont,center,dir,font,isindex,menu,s,strike,u.bandiare not deprecated.Elements deprecated in XHTML 1.0: Exactly the same as for HTML 4.01. Again,
boriare not deprecated.As for XHTML 2.0, given that it’s unlikely to be widely used before the end of the decade, if ever, it seems very odd for you to regard preparing for that as more important than having your documents make sense to Lynx users right now.
(You’re probably not going to believe this, but I swear, that HTML coding error I just made was a genuine mistake. The first sentence should finish with “
u</code>“. But the opportunity is too good to resist making the point: If you were using XHTML 2.0, or even using 1.1 properly, and an XML-conformant browser, you would probably have great difficulty fixing the problem.)Matthew, I fixed your comment typo.
Perhaps the correct media type header could be built (as a hack, or standard feature) into WordPress.
According to Mr Mullenweg, early versions of WordPress used to do that, but it no longer does, because .