<pre>
HTML <pre> Tag
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <pre> 此例演示如何使用 pre 标签 对空行和 空格 进行控制 </pre> </body> </html>
Run Example»
Click the "Run Instance" button to view the online instance
Browser support
Currently most browsers support < pre> tag.
Tag definition and usage instructions
<pre> tag can define pre-formatted text.
Text enclosed in <pre> tag elements usually preserves spaces and newlines. The text will also be rendered in a fixed-width font.
Tips and Comments
Tips: A common application of the <pre> tag is to represent computer source code.
Differences between HTML 4.01 and HTML5
In HTML 4.01, the "width" attribute is deprecated and cannot be used. HTML5 does not support the "width" attribute.
Properties
Properties | Value | Description |
---|---|---|
width | number | HTML5 does not support this attribute. This attribute has been deprecated in HTML 4.01. Defines the maximum number of characters per line (usually 40, 80, or 132). |
Global attributes
<pre> tag supports global attributes, see the complete attribute table HTML global attributes.
Event attributes
<pre> tag supports all HTML event attributes.