Posts in current category

HTML5 <pre> tag


May 03, 2021 18:00 HTML5


Table of contents


HTML5 labels preformat text in a document. Please refer to the following example:

Pre-formatted text:

<pre>
此例演示如何使用 pre 标签
对空行和 空格
进行控制
</pre>
Try it out . . .

Browser support

HTML5 <pre> tag HTML5 <pre> tag HTML5 <pre> tag HTML5 <pre> tag HTML5 <pre> tag

Most browsers currently support the hashtag.


Label definition and instructions for use

Labels define pre-formatted text.

Text that is surrounded by the label element usually retains spaces and line breaks. The text is rendered as an equal width font.


Tips and comments

Tip: A common application of tags is to represent the source code of your computer.


The difference between HTML 4.01 and HTML5

In HTML 4.01, the "width" property is obsolete and unavailable. HTML5 does not support the "width" property.


Property

Property Value Describe
width number HTML5 does not support this property. H TML 4.01 has discarded the property. Defines the maximum number of characters per line (usually 40, 80, or 132).


Global properties

The label supports global properties and views the full property sheet HTML global properties.


The event property

The label supports all HTML event properties.