Preformatted Text
Sometimes you want to display just as you entered it, such as with tables or with listings of source code. Enclose such text with <pre> and </pre> commands. Text within a preformatted block will be displayed using the typewriter (fixed width) font.
Simple Example
|
HTML
<pre>
main ()
{
printf ("Hello World!\n");
}
</pre>
|
|
How It Displays
main ()
{
printf ("Hello World!\n");
}
|
More Complicated Example
- Character display commands such as <B> and <I> work within preformatted text blocks.
- To show &, <, or > characters within a preformatted block, you must use codes (&, <, and >).
- Links and graphics can also be placed within preformatted blocks.
|
HTML
<pre>
<i>Conference Expenses Summary</i>
<b>Name Total Expenses</b>
Ralph $345.98
Henry $402.91
Linda $398.11
<a href="http://www.washington.edu/">UW Home Page</a>
</pre>
|
|
How It Displays
Conference Expenses Summary
Name Total Expenses
Ralph $345.98
Henry $402.91
Linda $398.11
UW Home Page
|
Specifications
From the W3Schools.Com Complete HTML/XHTML Reference: