HTML Pre Tag

About the HTML pre Tag, its standard attributes, when and how to use it.

The HTML pre element is used to markup preformatted text. Many sites are also using it to markup code examples, by replacing them with &gt; for ">" and &lt; for "<".

Attributes

Standard Attributes

Attribute:Value:Description:
AttrsGlobal AttributesGlobal, Event, I18n

How to use HTML pre

The below shows how to markup code in HTML pages, using pre tags.

 <pre>
  &lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;

  &lt;head&gt;
    &lt;title&gt;My first Website&lt;/title&gt;
  &lt;/head&gt;

  &lt;body&gt;
    &lt;p&gt;My first Website.&lt;/p&gt;
  &lt;/body&gt;

&lt;/html&gt;
 </pre>

Post comment

Links that you insert are not nofollowed, but will be removed by admins if they are considered spam.

[url=Absolute URL for page]TITLE[/url]

You should insert code boxes around code examples, which will be automatically syntax highlighted.

[code1 html|css|javascript|php|sql]Your Code Here[/code1]

You may want to read our Privacy Policy before submitting your comment.