Well, <code> comes especially useful compared to <pre> when you
need to reference some code inline. For example:

  <p>Use <code>len(<var>A</var>);</code> do determine the
  size of an array <var>A</var>.</p>

Like you see, I have used the <var> element to denote variables -
actually I've never seen this being done (usually sites who
offer colored source code just use font-tags to acieve the effect).

<pre> is for any kind of preformatted text, but it is
owerwhelmingly used for computer code. The <pre><code> combination
is probably the best you can get.

Althought you can make <code> to behave like <pre> with CSS,
it wouldn't be wise, because non-css browsers would see a mess
instead of preformatted text.

There is also the <samp> element, which can be used for sample
output of programs, like:

  <pre>
  [EMAIL PROTECTED] $ uptime
  <samp>01:18:12 up 11:01,  1 user,  load average: 0.81, 0.59, 0.50</samp>
  </pre>

question remains... should the uptime-command I gave be marked up as
<code> because it's the one-line shell-script I wrote, or as
<samp>, because it's the output of Bash? There probably is no correct
answer - just to show how hard it can be to distinguish between
program and it's output.

Hey, but there's also the <kbd> element for user-entered text, so maybe:

  <pre>
  [EMAIL PROTECTED] $ <kbd>uptime</kbd>
  <samp>01:18:12 up 11:01,  1 user,  load average: 0.81, 0.59, 0.50</samp>
  </pre>

Well, in real life people probably wont bother to parse the shell output
the way I have done - I think <pre> and <samp> inside there should be enough.


Hopefully you got the idea, that there might be a lot of different semantical
meanings inside one <pre>.



There's one thing bothering me - for some strange reason Opera renders <code> by default in almost invisible color (anyone knows why?)



Rene Saarsoo
******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************



Reply via email to