<pre> Syntax
Syntax Diagram for <pre>
Opening Tag |
Content |
Closing Tag |
<pre> |
text |
</pre> |
<pre> Description
The <pre>. . . </pre> tags declare
the text that occurs between them to be pre-formatted, and therefore, no
line-wrapping should take place. The pre-formatted text is also separated
from the surrounding text by blank lines, to ease visual separation. Because
the most common use of this is computer program listings, the text is also
displayed in a typewriter font (whose monospacing allows alignment--of
comments, for example--to appear).
Pre-formatted text allows HTML tags to be interpreted, unlike <xmp>.
<pre> Examples
This markup:
Type in the following simple program:
for (I=1; I!=10; I++) { # set up the loop
print "I is $I\n"; # print current value
} # end the loop
And then run it.
. . .causes the following to be displayed:
Type in the following simple program:
for (I=1; I!=10; I++) { # set up the loop
print "I is $I\n"; # print current value
} # end the loop
And then run it.
This example shows how HTML tags are interpreted within a pre-formatted block
of text. This markup:
Here is some bold and
some italic text.
. . .causes the following to be displayed:
Here is some bold and
some italic text.
Last Modified: