Arrow

HTML Pre Tag

AuthorHariom Prajapati

Pubish Date24 Mar 2024

categoryHTML 5

In HTML, the <pre> tag is used to display pre-formatted text. This tag is used in situations where you want to preserve the text exactly as it appears, including styles, spacing, and line breaks.

Syntax

<pre> </pre>

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Pre Tag</title>
</head>
<body>
<pre>
This is a pre-formatted text.
It will preserve spacing, styles, and line breaks.
</pre>
</body>
</html>

Output

Try it Yourself »