In this section, we will learn what the <pre> element is and how to use it.
What is <pre> Tag in HTML?
HTML <pre> element stands for preformatted and is used when we want to add a text content to an HTML document and want it to be displayed the same way that was written in the body of the <pre> element.
Basically, content in the body of a <pre> element keeps its format (font width, spaces, and line breaks).
Note: if you use the <p> element to add text content to an HTML document, the format of those contents will be lost and you need to use CSS to reformat the content.
HTML <pre> Tag Syntax:
<pre> content... </pre>
HTML <pre> Tag Values
The value of the <pre> element is a preformatted text content that we want it to be displayed the same way that was written in this body.
Example: using <pre> tag in HTML
See the Pen using <pre> tag in HTML by Omid Dehghan (@odehghan) on CodePen.