how to use the pre tag in html

how to use the pre tag in html

web designing theory

What is the <pre> Tag

✅HTML <pre> tag use to display performatted text.
✅Browser shows text exactly as it written in the HTML file.
✅Including space,indentation,line breaks.
✅<pre> tag define preformatted text and original formatting intact.

Key Features  of <pre> tag.

  ✔ Reserves whitespace (spaces & line breaks)
   Display text in monospace (fixed-width) font by default
  ✔ Useful for  showing code and formatted text.
  ✔ Keep text alignment exactly as written

  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 

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

Comments

Popular posts from this blog

how to add background image in html.

HTML pre tag

How to insert image in html

Html anchor tag

Inline css in html