Monospaced Text


<pre [width="n"]> ... </pre>
  • Preformatted text
  • Appropriate for multiple-line listings of source code
  • Multiple spaces are not collapsed
  • Newlines are not ignored
  • Vertical padding above and below
  • Width attribute specifies where to wrap the text (not always supported) (default: text does not wrap)
<code> ... </code>
  • Code fragments
  • Appropriate for short snippets of source code
  • Multiple spaces are collapsed
  • Newlines are ignored
  • Text wraps automatically
  • No vertical padding
<tt> ... </tt>
  • Teletype font (typewriter)
  • Behaves similarly to <code>
  • For source code, use <code> or <pre> instead
<font face="monospace"> ... </font>
  • Behaves similarly to <code> and <tt>