JavaScript EditorDebugger script     Dhtml css 



Team LiB
Previous Section Next Section

Using Preformatted Text

The PRE (Preformatted Text) element lets you include preformatted text in Web pages. Unlike in other HTML elements, all spaces and hard returns nested in a PRE element are displayed, rather than ignored. Text inserted in a PRE element is displayed in a monospaced (fixed-pitch) font (generally, Courier New). The example file contains a tabular arrangement of egg classifications and weights, formatted using spaces and returns. Use the PRE element to display it as it appears in a browser (see Figure 3.24):

<p>The size or weight class of a carton of eggs refers to the
minimum weight per dozen. Size and quality are not
related. The following table shows the different egg
weight classes:</p>
<!--Start preformatted text
<pre>
    Weight Class        Minimum Weight

    Jumbo               30 oz.
    Extra Large         27 oz.
    Large               24 oz.
    Medium              21 oz.
    Small               18 oz.
    Peewee              15 oz.
</pre>
End preformatted text-->

Click To expand
Figure 3.24: Spaces and hard returns are not ignored, but are displayed, when inserted inside of a PRE element.
Tip 

Using the PRE element, you can easily include worksheets exported from many spread-sheets in your HTML documents. Just export your document as a "print" file (or PRN file, with a .prn extension) and then copy and paste it into your HTML document. In Microsoft Excel, select File, Save As, and Formatted Text (Space delimited) (*.prn), to export a PRN file. The PRN format originated in Lotus 1-2-3, back when worksheets often had to be carried, via sneakernet, to be printed on another computer.


Team LiB
Previous Section Next Section


JavaScript EditorDebugger script     Dhtml css