Spread the love

HTML <pre> Tag

This HTML <pre> Tag is used to specify the pre-formatted text. The text inside the <pre><pre> Tag is displayed in a certain width font. Usually, it is displayed in courier fonts. It maintains both space and line brakes.

Pre <pre> Tag is widely used to display language examples e.g. Java, C #, C, C ++, etc. because it displays the typed code.

The HTML <pre> Tag defines pre-formatted text.

Example:-

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        HTML pre Tag
    </title>
</head>
<body>

<h1>This is HTML pre Tag Example</h1>
 
 <pre>
     Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
     tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
     quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
     consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
     cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
     proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 </pre>
</body>
</html>

Output:-

HTML P Tag

HTML <p> Tag

This HTML <p> Tag is used to define a paragraph in a webpage. Let’s take a simple example to see how it works. It is a significant point that the browser itself adds blank lines before and after paragraphs. The HTML
tag indicates the beginning of a new paragraph. Write a new paragraph within <p>…</p> Tag.

Example:-

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        HTML p Tag
    </title>
</head>
<body>

<h1>This is HTML p Tag Example</h1>
 
 <p>
     Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
     tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
     quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
     consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
     cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
     proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 </p>
 <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
 tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
 quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
 consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
 cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
 proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</body>
</html>

Output:-

What is the Difference Between p and pre-tag?

If you want to write a straight paragraph together, the <p> Tag is used while in the <pre> Tag you can break the line without using the paragraph <br> Tag. Simply writing in a new line means that its output will also come in a new line. <p> Tag is used to creating more websites.

Tip: This tag is not disliked. However, it is possible to achieve a rich effect using CSS (see example below).

HTML <code> Tag

HTML <samp> Tag

HTML <var> Tag

HTML <pre> Tag

HTML <kbd> Tag


Spread the love

Related Posts

One thought on “HTML Pre Tag

Leave a Reply

Your email address will not be published. Required fields are marked *