display text
where space and carriage return
characters count?
In previous lessons we have seen that a web browser will ignore extraneous space characters, tabs, and carriage returns. However, there are some instances where it will be important to maintain these aspects of page layout. In this lesson, the example will be where we want to insert a table of text with aligned columns.
The preformat tag instructs your web browser to display the text exactly as typed in the HTML document, including spaces, tabs, and carriage returns. A browser typically displays such text as a m o n o s p a c e d type. An example of the preformat tag:
<pre>
We have indented with 5 space characters.
And used the carriage return to jump
to
a
new
line.
Here we
use
spaces to
create a
text table.
</pre>
Without the <pre> and </pre> tags,
the same HTML produce:
We have indented with 5 space characters. And used the carriage return to jump to a new line. Here we use spaces to create a text table.
For our Volcano lesson, we want to add a table under the Introduction section that lists several well-known volcanoes, when they erupted, and the volume of erupted material. To do this:
<pre> Eruption Date Volume in km^3 -------- ---- -------------- Paricutin, Mexico 1943 1.3 Mt. Vesuvius, Italy 79 A.D. 3 Mount St. Helen, Washington 1980 4 Krakatoa, Indonesia 1883 18 Long Valley, California pre-historic 500 - 600 Yellowstone, Wyoming pre-historic 2400 </pre>
In this example we use space characters to make the first column left justified and the other 2 columns center-justified. The dashes are used to highlight the column headings.
This tutorial is copyright 1995 by
maricopa center for learning and instruction
Be sure to tell all of your friends about it!
We
Welcome
Your
Feedback
Which is produced by the HTML:
<pre>
This tutorial is copyright 1995 by
<A HREF="http://www.mcli.dist.maricopa.edu/">maricopa center for learning and instruction</A>
<B>Be sure to tell all of your friends about it!</B>
<i> We
Welcome
Your
Feedback</i>
</pre>
Note that the HTML tags do not count as spaces; they are ignored within the preformat region.
The Internet Connection at MCLI is
Alan Levine --}
Comments to levine@maricopa.edu
URL: http://www.mcli.dist.maricopa.edu/tut/tut9.htm