Examples of
monospaced text include the "
courier"
font and the output of old-style
typewriters.
There are actually four HTML tags which result in monospacing. <PRE>, as /dev/joe mentions above, will allow you the luxury of more than one space in a row without resorting to , and lets you use simple linebreaks instead of having to use <BR> every time. However there are three more monospacing tag which simply use a monospace font without absolving the normal html whitespace rules; the three are identical in appearance, but are intended to be used in different circumstances.
- <TT> is terminal-type information-- anything labelled as TT is supposedly something that you would view in to a *n?x terminal, into telnet, or some other command-line interface.
- <CODE> is, well, code. I believe its specific use is when you wish to quote examples of HTML-- like, give blocks of visible uninterpreted code-- although it is used for all programming languages as well.
- <KBD> is "keyboard"-- anything that is meant to be typed in somewhere by the reader.
While almost nobody actually distinguishes between these three, the
w3c would like you to separate the three-- they like it when people use HTML to flag
content rather than just
style, plus it gives people the option of overriding
cascading style sheets to get slightly different results when something is
TT,
CODE or
KBD, so that they can understand more clearly what you are trying to express to them.
E2, unfortunately, only allows the
TT tag.
The advantage of specifying something as monospace is that you have strict control over where characters are in relation to each other across different environments-- fonts can change, the size of a tab can vary, and text can shift unless it is monospaced. This stability is nice when you have ASCII art, or some kind of code in which formatting is extremely important.