description & Usage
The <pre> tag is used to display preformatted text.
In simpler terms, if you want to write some text in HTML and have it displayed in the browser exactly as written, we use the <pre> tag.
For example, if you want to place multiple spaces between two words in a text or force a line break at a certain point.
Browsers use a monospace font for the content inside this tag.
Related tags to <pre> are:
description | tag |
---|---|
Display computer code font-family: monospace |
|
Display computer code output font-family: monospace |
|
Show keyboard buttons font-family: monospace |
|
Display variable and mathematical expression font-style: italic |
|
Pre-formatted text font-family: monospace There are other default styles |
|
Browser compatibility and Support
# | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
<pre> |
Global Attributes
The <pre> tag supports the HTML Global Attributes.
Event Attributes
The <pre> tag supports the HTML Event Attributes.
Default CSS
Most browsers will display the <pre> tag with the following default style: