Loading...
Loading...
00:00:00

<pre> Tag : Write Code in HTML Document

The <pre> tag in HTML5 is short for "preformatted text". This tag is used to display text on a web page with a fixed width font and preserves both spaces and line breaks. The text within a <pre> tag is typically displayed in a monospace font and any whitespace characters in the source code, such as spaces and tabs, are respected and preserved in the output.

<pre>
This is some preformatted text.
It will be displayed
         exactly as written,
including spaces and line breaks.
</pre>

In this example, the text inside the <pre> tag will be displayed with a fixed width font and all of the line breaks and spaces will be preserved.

It's important to note that the <pre> tag should only be used for small amounts of text, as it can create layout problems if there is a lot of text or if the text is too wide for the available space. In those cases, it's better to use other techniques such as CSS to control the display of text.