HTML pre Tag

HTML pre Tag defines preformatted text, The text inside pre tag is displayed as it is. Line breaks and Spaces are also displayed and the formation of text is kept as it is while displaying it.

Syntax of HTML pre Tag

The Syntax of HTML pre Tag is shown below, It has both starting tag and ending tag.

<pre>
</pre>

Usage of HTML pre Tag

HTML pre Tag is used to display the text as it is written in HTML code. User can control the text formation directly from the HTML code.

The pre tag is mostly used for poetry and quotes.

Example of HTML pre Tag

Simple example of HTML pre Tag is given below.

<pre>
This is first line of Pre Tag.
This is second line of Pre Tag after a line break.
</pre>

Output

This is first line of Pre Tag.
This is second line of Pre Tag after a line break.

In above example we have used pre tag to display the text as it is. Line break used in HTML code is preserved by the pre tag.

Browser Support for HTML pre Tag

HTML pre Tag is supported by all major browsers which include Chrome, Opera, Firefox, Edge and Safari.

Global Attributes Support in HTML pre Tag

The HTML pre Tag supports all Global Attributes.

Event Attributes Support in HTML pre Tag

The HTML pre Tag supports all Event Attributes.

HTML anchor Tag HTML abbr Tag HTML acronym Tag HTML address Tag HTML applet Tag HTML area Tag HTML article Tag HTML aside Tag HTML audio Tag HTML b Tag HTML base Tag HTML basefont Tag HTML bdi Tag HTML bdo Tag HTML big Tag HTML blockquote Tag HTML body Tag HTML br Tag HTML Button Tag HTML Canvas Tag HTML Caption Tag HTML Center Tag HTML Cite Tag HTML Code Tag HTML Col Tag HTML colgroup Tag HTML comment Tag HTML data Tag HTML datalist Tag HTML dd Tag HTML del Tag HTML details Tag HTML dfn Tag HTML dialog Tag HTML dir Tag HTML div Tag HTML dl Tag HTML Doctype Tag HTML dt Tag HTML em Tag HTML embed Tag HTML fieldset Tag HTML figcaption Tag HTML figure Tag HTML font Tag HTML footer Tag HTML form Tag HTML frame Tag HTML frameset Tag HTML Heading Tags HTML head Tag HTML header Tag HTML hr Tag HTML html Tag HTML i Tag HTML iframe Tag HTML img Tag HTML input Tag HTML ins Tag HTML kbd Tag HTML label Tag HTML legend Tag HTML li Tag HTML link Tag HTML main Tag HTML map Tag HTML mark Tag HTML meta Tag HTML meter Tag HTML nav Tag HTML noframes Tag HTML noscript Tag HTML object Tag HTML ol Tag HTML optgroup Tag HTML option Tag HTML output Tag HTML p Tag HTML param Tag HTML picture Tag HTML pre Tag HTML progress Tag HTML q Tag HTML rp Tag