How to create Paragraphs in HTML Page?


The paragraph in the HTML document is used to express thoughts on the point in a clear way. In HTML the paragraph information placed inside the <p>…</p> tags.

The <p> tag in HTML defines a paragraph. These have both opening and closing tags. So anything mentioned within <p> and </p> is treated as a paragraph.

A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph. The <p> tag should be placed inside the body tag.

Syntax

Following is the syntax for the <p> tag.

<p> paragraph of the content</p>

Example

Following is the example program for the paragraph tag.

<!DOCTYPE html>
<html>
<head>
   <title>Title of the page</title>
</head>
<body>
   <p>This is a paragraph</p>
</body>
</html>

Following is the output for the paragraph tag. The information inside the <p> tag gets displayed on the browser as it is placed inside the body tag.

How to draw a horizontal line?

The <hr> tag defines a break in an HTML page, or it is used to separate content in an HTML page using a horizontal line and is most often displayed as a horizontal rule.

The <hr> tag is most often used to divide the content on the HTML page. It should be placed inside the body tag.

Syntax

Following is the syntax for the <hr> tag.

<hr>...

Example

Following is the example program for the <hr> tag.

<!DOCTYPE html>
<html>
<head>
   <title>Title of the page</title>
</head>
<body>
   <p>The Parliament of India is the supreme legislative body of the Republic of India</p><hr> 
   <p> It is a bicameral legislature composed of the President of India and two houses: the Rajya Sabha-Council of States and the Lok Sabha-House of the People. <hr> </p> 
   <p>The President in his role as head of the legislature has full powers.</p> <hr>
</body>
</html>

Following is the output for the <hr> tag. As we see the <hr> tag display a horizontal line break on the web page.

Inline breaks

<br> tag is used to produce a line break in the text. And used where the division of lines is significant.

The <br> tag should be placed inside the body tag.

Syntax

Following is the syntax for the <br> tag.

<br>...

Example

Following is the example program for the <br> tag.

<!DOCTYPE html>
<html>
<head>
   <title>Title of the page</title>
</head>
<body>
  <p>The Parliament of India is the supreme legislative body of the Republic of India. <br>It is a bicameral legislature composed of the President of India and two houses:<br> the Rajya Sabha-Council of States and the Lok Sabha-House of the People. 
  <br> The President in his role as head of the legislature has full powers. </p>
</body>
</html>

Following is the output for the <br> tag. As we see the breaks in the sentence in below output.

Updated on: 11-Nov-2022

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements