HTML Paragraphs

We will learn about HTML paragraphs and their fundamental implementation through examples in this post. A paragraph is defined by the HTML <p> element. Both the opening and closing tags are present. As a result, everything between <pgt; and </pgt; is considered as a paragraph. Even if we don't use the closing tag, </pgt;, most browsers perceive a line as a paragraph, which might lead to unexpected consequences. As a result, it is both a good convention and a requirement that we utilise the closing tag.

How to Write HTML Paragraphs

HTML paragraphs separate textual information on web pages. To separate paragraphs from one another, web browsers automatically add a margin (white space) after and before them.

<!DOCTYPE html>
<html>
  <head>
    <title>This is a heading</title>
  </head>
  <body>

    <p>This is a paragraph example line 1</p>
    <p>This is a paragraph example line 2</p>
    <p>This is a paragraph example line 3</p>

  </body>
</html>

Output of HTML Paragraphs

It's simpler to read and access your material if you divide it into HTML paragraphs. Assistive devices (such as screen readers) detect these and allow users to skip paragraphs.

This is a paragraph example line 1

This is a paragraph example line 2

This is a paragraph example line 3

HTML Paragraphs With <br>

You'll note that hitting ENTER does not result in a new line when composing HTML paragraphs. The <br> element in HTML defines a paragraph break

Line breaks are defined using the HTML <br> element. and If you wish to start a new paragraph without opening a new line, use
:

<!DOCTYPE html>
<html>
  <head>
    <title>This is a heading</title>
  </head>
  <body>

    <p>This is a best tutoriaols for html paragraphs 
      This is a best tutoriaols for html paragraphs 
      This is a best tutoriaols for html paragraphs</p>

    <p>This is a best tutoriaols for html paragraphs <br> 
      This is a best tutoriaols for html paragraphs <br> 
      This is a best tutoriaols for html paragraphs</p>

  </body>
</html>

Output of HTML Paragraphs With <br>

When you need to create an HTML new line but not a new paragraph, use the br> element. It does not have a closing tag since it is an empty element.

This is a best tutoriaols for html paragraphs This is a best tutoriaols for html paragraphs This is a best tutoriaols for html paragraphs

This is a best tutoriaols for html paragraphs
This is a best tutoriaols for html paragraphs
This is a best tutoriaols for html paragraphs

Notes : You need to use the <pre> tag when you want the same output as text. For which follow the example given below

HTML Paragraphs With <pre> tag

The text within a <pre> element is shown in a fixed-width font (typically Courier), with spaces and line breaks preserved:

<!DOCTYPE html>
<html>
<head>
  <title>This is a pre tag</title>
</head>
<body>

  <pre>
  This is a best tutoriaols for html pre tag 
    This is a best tutoriaols for html pre tag 
    This is a best tutoriaols for html pre tag
  </pre>

</body>
</html>

Output of HTML <pre> tag

      This is a best tutoriaols for html pre tag 
      		This is a best tutoriaols for html pre tag 
      		This is a best tutoriaols for html pre tag
      

HTML Paragraphs With <hr>

A horizontal line is drawn between two statements or paragraphs using the HTML <hr> element. The following is an example of how to use the <hr> tag with a paragraph.

<!DOCTYPE html>
<html>
<head>
  <title>This is a hr tag</title>
</head>
<body>

  <h2> This is a horizontal line</h2>
  <p> A horizontal line is drawn between two statements or paragraphs using the HTML hr element. The following is an example of how to use the <hr> hr tag with a new paragraph.</p>
  
</body>
</html>

Output of HTML Paragraphs With <hr>

This is a horizontal line

A horizontal line is drawn between two statements or paragraphs using the HTML <hr> element. The following is an example of how to use the


hr tag with a new paragraph.