html tutorial - <pre> Preformatted Text Tag in HTML - html5 - html code - html form




pre tag

Learn html - html tutorial - pre tag - html examples - html programs

  • The <pre> tag is representing preformatted text.
  • The text within this element is displayed in monospace font.
  • The <pre> tag is displayed with fixed-width font and it reserves both line break and spaces.
  • <pre> tag is belongs to Palpable content and Flow content.

Syntax for <pre> tag in HTML:

<pre>content</pre>

Differences between HTML 4.01 and HTML 5 for <pre> tag:

HTML 4.0.1

  • HTML 4 is supports all the attributes of <pre> tag.

HTML 5

  • HTML 5 is not supports width attribute of <pre> tag.

Sample Coding for <pre> tag in HTML:

Tryit<!DOCTYPE html>
<html >
    <head>
        <title>Wikitechy pre tag</title>
    </head>
    <body>
        <h3>Wikitechy HTML pre tag.</h3>
        <pre>
        The HTML  pre element represents preformatted text. 
        Whitespace inside this element is displayed as typed.
        </pre>
        <p>
        The HTML  pre element represents preformatted text. 
        Whitespace inside this element is displayed as typed.
        </p> 
    </body>
</html>

Code Explanation for <pre> tag in HTML:

Preformatted Text <pre> Tag Code Explanation

  1. The text within the <pre> element will be displayed as a preformatted text.

Output for <pre> tag in HTML:

Preformatted Text <pre> Tag Output

  1. <pre> tagged text is displayed the preformatted form with line break and spaces.
  2. But the normal text remove unwanted spaces.

Attribute for <pre> tag:

Attribute Value HTML 4 HTML 5 Description
width number Yes No It is used to set the maximum number of a characters per line.

Browser Support for <pre> tag in HTML:

Yes Yes Yes Yes Yes

Tips and Notes

  • By using the <pre> element the text is displayed with unusual format or some sort of computer code.
  • It displayed line between the paragraphs.

Related Searches to <pre> tag in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×