HTML paragraph tag

Paragraphs are created using the <p> tag. The paragraph breaks are added between the closing and opening <p> tag in the text.

<p> : Starts a new paragraph, <p> tag is used to end the paragraph

👉Line breaks

<br> tag used 

Example:

<p>
This is a paragraph
<br>
with line break
</p>

<br> tag 

Example:

<!DOCTYPE html>
<html>
<head>
<title> BR Tag in HTML </title>
</head>
<body>
<h1> I am your friend<br>I like your smile </h1>
</body>
</html>

👉Horizontal rules

<hr> tag to create horizontal rules or line

Example:

<p> This is a paragraph </p>
<hr>
<p> This is a another paragraph </p>

<hr> tag

Draws a horizontal line. The attribute size = "50%" (any percent will do) draws a line of that percentage of the screen width. The attribute align = can be used to move the line to left, center or right.

Example:

<!DOCTYPE html>
<html>
<head>
<title> HR Tag in HTML </title>
</head>
<body>
<h1 align = center> What is hr tag? </h1>
<hr color = red size = 10 width = 300 align = center>
The hr tag defines a thematic break in an HTML page. The hr element is most often displayed as a horizontal rule that is used to separate content in an HTML page.
<hr color = blue size = 5>
<body>
</html>

Attribute

👉Align

  • Left
  • Right
  • Center
  • Justify

Example (<p> tag):

<!DOCTYPE html>
<html>
<head>
<title> Paragraph Tag in HTML </title>
</head>
<body>
<h2> What is paragraph tag? </h2>
<p align = center> The HTML <p> element represents a paragraph. Paragraph are usually represented in visual media as blocks of text separated from adjacent blocks by blank line and first line indentation, but HTML paragraphs can be any structural grouping of related content, such as images or form field.
</p>
<p align = justify>
Separated paragraphs with blank lines is easiest for readers to scan, but they can also be separated by indenting their first line. This is often used to take up less space, such as to save paper in print.
</p>
</body>
</html>

NOTES.....

The closing </p> tag, while not required, is important for defining the extract contents of a paragraph for CSS. Most web designers use it automatically, but if you don't need it, you can leave it out your HTML. Closing tags also required for XHTML 1.0.

Previous Post Next Post