ad

Tuesday, November 25, 2025

how to use the pre tag in html

how to use the pre tag in html

web designing theory

<Pre> tag Syntax

Syntax 

 Syntax of HTML <Pre> tag


<pre>
.
.
</Pre>

  • <pre> tag  defines preformatted text. text in <pre> element display fixed-width font and text preserves.
  •  <pre> tag  use preserves  space, fixed-width ,line breaks 

how to use the pre tag in html
Example 

<!DOCTYPE html>
<html>
<body>
<h1>The pre Element</h1>
<pre>
    Text pre html tag
      pre tag displayed in a fixed-width,
        text font and it preserves
          both width and font spaces
             line breaks  automated create pre tag html
       
</pre>
</body>
</html>

how to use the pre tag in html

Explain Program

Step  1] 

<!DOCTYPE html>

This declare the document type.

browser that the document is written in html

Step 2 ]

<html>.... . </html>

html is the root element of the html page.

 Every thing inside it is part of the webpage.

Step 3]

<body>.....</body>

<body> tag contains  all the visible content of the page.

inside <body> show the browser screen.

Step 4]

<h1>The pre Element</h1>

<h1> creates the largest  heading tag.

heading tag use the main title.

Step 5]

<pre> ...</pre>

 preserves spaces and formatting  

 preserves line breaks

 preserves fixed-width 

Step 6]

closing the Tag


</body>

 </html>

how to use the pre tag in html

Output

how to use the pre tag in html






Related Post :-

html link tag explain

how to use pre tag html

html heading tags explain