HTML Pre <pre>

Usage

The HTML pre tag defines text that is pre-formatted.

Any text within the pre code will keep the exact formatting you place in the document, mainly spaces and lines.

The below code block is in a pre tag.

Code:



<pre>
<code>
<!DOCTYPE html>
<html>
<head>
<!-- This is the stylesheet John created in 2020 -->
<link rel="stylesheet" href="/file/stylesheet.css">
</head>

<body>

<div id="openingparagraphs">

<p>Welcome to my webpage and paragraph 1.</p>

<p>I have so much to say I'm going to need a lot of paragraphs!</p>

This text has lots    of     spaces and

line    breaks.

</div>

</body>

</html>
</code>
</pre>

Output:

Welcome to my webpage and paragraph 1.

I have so much to say I’m going to need a lot of paragraphs!

This text has lots    of     spaces and

line    breaks.