Learn Scripting Languages from the Master!
With the <pre> tag, the text renders in the browser exactly as you type it. The <pre> tag is short for preformat. So if you press the ENTER or RETURN key several times to create line breaks within a <pre> tag, you can expect to see all those line breaks in a browser.
The following shows the <pre> tag in use:
<pre> tag in use to preformat text |
That prints:
This is an example of preformatted text. The text appears in the browsers exactly as it is typed.
This example creates a tubular data:
Tabular data with pre tag |
A | B C | DD
Notice the tabs and the line breaks in each example above are expectedly present in the output. However, the output of the <pre> tag is not guaranteed to remain as visualized for these reasons:
The use of <pre> tag is useful for displaying programming code.