How to markup sample code.

In most of W3C specification, long sample code is marked
by <pre>...</pre>, without <code>...</code>.
But I usualy markup such code as:

  <pre><code>a {
    text-decoration:underline;
  }</code></pre>

This markup is bad?

HTML 2.0 [1] says :

> The CODE element is intended for short words or phrases of code;
> the PRE block structuring element (section Preformatted Text: PRE)
> is more appropriate for multiple-line listings.

HTML 3.2 [2] says:

> CODE: used for extracts from program code

HTML 4.01 [3] says:

> CODE: Designates a fragment of computer code.

These description means that <code> shouldn't be used for
*long* or *entire* computer code? Should I mark it as follows?

  <pre>a {
    text-decoration:underline;
  }</pre>


[1] http://www.w3.org/MarkUp/html-spec/html-spec_5.html#SEC5.5.2
[2] http://www.w3.org/TR/REC-html32#phrase
[3] http://www.w3.org/TR/html4/struct/text.html#h-9.2.1

-- 
Satoshi ISHIKAWA <pastelsbadges@nyc.odn.ne.jp>
http://math.oheya.to/markup/

Received on Thursday, 11 July 2002 17:28:47 UTC