English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <pre> tag defines preformatted text that preserves whitespace and line breaks in the HTML document. This tag is also commonly referred to as the <pre> element.
Formatted Text:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic Tutorial(oldtoolbag.com)</title> </head> <body> <pre>Text goes here preserving whitespace and preserving line breaks</pre> </body> </html>Test to see ‹/›
IEFirefoxOperaChromeSafari
Most browsers currently support the <pre> tag.
The <pre> tag can define preformatted text.
Spaces and line breaks within the <pre> tag will be preserved and displayed exactly the same as the spaces within the <pre> tag.
Text enclosed in <pre> tag elements usually preserves spaces and line breaks. The text will also be displayed in a monospaced font.
Hint: A common use of the <pre> tag is to represent the source code of a computer.
in HTML 4.01 in, the "width" attribute is deprecated and cannot be used. HTML5 The "width" attribute is not supported.
Attribute | Value | Description |
---|---|---|
width | number | HTML5 This attribute is not supported. HTML 4.01 This attribute is deprecated. Define the maximum number of characters per line (usually 40,80 or 132) |
<pre> tag supports global attributes, see the complete attribute table HTML Global Attributes.
<pre> tag supports all HTML Event Attributes.