By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

HTML Pre Tag

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

Edited: 2014-12-28 07:09

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>