Latest web development tutorials

HTML <pre> tag

Examples

Preformatted text:

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

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Most browsers support <pre> tag.


Tag definitions and instructions

<Pre> tag define a pre-formatted text.

Is enclosed in <pre> tag text in the element is usually reserved spaces and line breaks. The text will be presented as a monospaced font.


Tips and Notes

Tip: A common use <pre> tag is used to represent computer source code.


Differences in the HTML 4.01 and HTML5

In HTML 4.01, "width" property has been abandoned, unusable. HTML5 does not support the "width" property.


Attributes

属性 描述
width number HTML5 不支持该属性。HTML 4.01 已废弃该属性。 定义每行的最大字符数(通常是 40、80 或 132)。


Global Properties

<pre> tag supports the global attributes, view complete the property sheet HTML Global Attributes .


Event Properties

<pre> tag supports all HTML event attributes .