Markdown-Discuss Digest, Vol 26, Issue 22

Jon Noring jon at noring.name
Thu Dec 1 10:45:57 EST 2005


Jonathan wrote:


> Good catch - I think a lot of people get scared of <b> and <i> when

> they first discover standards-based design, which leads to craziness

> like:

>

> I <span class="bold">really</span> haven't got this whole <span

> class="italic">>semantic</span> thing sussed yet.

>

> As far as I recall, <b>, <i> and <span> are precisely equivalent from

> a semantic standpoint, with the added "bonus" that <b> and <i> have

> vaguely reliable "default" behaviours that might be handy, but should

> never be relied upon.


In XHTML, <span>, <b>, and <i> are all inline elements, and thus from a
DTD content model perspective are equivalent.

They have different meanings, though. <span> is intended to be
generic, while <b> and <i> have non-generic meanings which are obvious
to all.

With respect to rendering, all visual browsers (aka "user agents") have
a default style sheet, and since <span> is generic, the default for
<span> is no styling other than what is inherited. However, <b> always
has a font-weight of bold, and <i> always has a font-style of italic.

If one wants their documents to be acceptably viewable without
supplying CSS (that is, use only the browser's default style sheet),
then one should use <i> and <b> (or <em> and <strong>) instead of
<span>. If one wants to add semantic meaning as to *why* something is
highlighted, one can always add a class to the <i> and <b> tags, viz.

<p>The title of the article is <i class="articletitle">How To
Properly Mark-Up XHTML</i>.</p>


On a related note, XHTML 2.0 is dumping <i> and <b> in favor of <em>
and <strong>, respectively, which from a semantic point-of-view makes
more sense (albeit does not solve all the semantic issues with regards
to highlighted text.)

Jon Noring



More information about the Markdown-Discuss mailing list