Preformatted Text

Contact Us or call 1-877-932-8228
Preformatted Text

Preformatted Text

Occasionally it is desirable to output content as it is laid out in the code, whitespace and all. The <pre> tag is used for this purpose. It is often used in online coding tutorials so that the whitespace shown in the tutorial reflects how it would appear in the document it represents. The code below shows how <pre> is used.

Code Sample:

<html lang="en">
<meta charset="UTF-8">
<title>Preformatted Text</title>
<h1>Your First HTML Page</h1>
&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;title&gt;Hello world!&lt;/title&gt;
	&lt;h1&gt;Hello world!&lt;/h1&gt;

Code Explanation

The page is rendered as follows:First HTML Page