HTML <pre> Tag


The <pre> HTML element defines a block of pre-formatted text. Such text is usually displayed in a monospaced font (fixed width). By default, any number of spaces in the code in a row on a web page is shown as one. The <pre> element allows you to bypass this feature and display the text as required by the developer.


Permitted Parents
Any element that accepts flow content
Most inline tags and text
Start/End Tags
Start tag: required, End tag: required


Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks


Attribute Definition
width Specifies the desired width of the preformatted text.

Global Attributes

The <pre> tag also supports the Global Attributes in HTML5

Event Attributes

The <pre> tag also supports the Event Attributes in HTML5

Browser Support

Explorer Edge Chrome Firefox Opera Safari
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung

Last updated by CSSPortal on: 6th December 2019