What is the <pre> element in HTML?

In HTML, the <pre> element is used to display preformatted text in a fixed-width font, preserving both spaces and line breaks. <pre> displays the text in the exact format on the HTML page.

Syntax

Error: Code Widget Crashed, Please Contact Support

Example

The following code demonstrates the usage of the <pre> element in HTML. The content that we want to display as preformatted text is written within the opening and closing tags, <pre> and </pre>.

Error: Run JS Widget Crashed, Please Contact Support

Free Resources