Loading...
HTML <pre> Tag

HTML <pre> Tag

In this tutorial, we will learn about pre tag in HTML with the help of examples.


<pre> Tag

Pre tag <pre> is used to define preformatted tag i.e. the text will be displayed exactly same as written in the HTML source code.

Note : It will preserve both spaces and line-breaks as same as source code.

Syntax

<pre>.........</pre>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Pre Tag</title>
  </head>
  <body>
    <pre>This is text inside the pre tag.</pre>
  </body>
</html>

Output

This is text inside       the pre tag.

Specific Attribute

Attribute Value Description
width number It specifies the desired width of the preformatted text

Global Attribute

Pre Tag support all the global attributes of HTML.


Event Attribute

Pre Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <pre> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <progress> Tag.

- Related Topics