Paragraph Tag in HTML | HTML P Tag

This article is created to describe one of the most commonly used tags in an HTML document. which is the P tag. The P stands for paragraph.

HTML documents are divided into different paragraphs. Generally, a new paragraph is started by pressing the ENTER key. However, in HTML, the browser does not understand the space created by the ENTER key. Therefore, a special element or tag, i.e., P, known as the paragraph element, has to be inserted at the point from which we want to begin a new paragraph.

The paragraph tag is a container tag, which means it has both the opening <p> and the closing </p> tags. For example:

HTML Code
<!DOCTYPE html>
<html>
   <body>
      
      <p>This is the first paragraph.</p>
      <p>This is the second paragraph.</p>
      <p>This is the second paragraph.</p>

   </body>
</html>
Output

This is the first paragraph.

This is the second paragraph.

This is the second paragraph.

Note: Browsers automatically add an empty line before and after a paragraph.

Colorize the paragraph

The color of the text produced using the P tag will be black by default. Therefore, to customize its color, you can use the "style" attribute in a similar way as shown in the example given below. Following this example, use the "style" attribute to change the color of the paragraph to red.

HTML Code
<!DOCTYPE html>
<html>
   <body>
      
      <p style="color: red;">This is a paragraph.</p>

   </body>
</html>
Output

This is a paragraph.

Change the background color of the paragraph

To change the background color of a paragraph, use the "style" attribute again by replacing the "color" property with the "background-color" property in a similar way as shown in the example given below:

HTML Code
<!DOCTYPE html>
<html>
   <body>
      
      <p style="background-color: cyan;">This is a paragraph.</p>

   </body>
</html>
Output

This is a paragraph.

I will not go into further detail because this is not a tutorial on "CSS." However, if you want to experience the look and feel of the content on the web, you can refer to our "CSS tutorial."

Before I wrap up this topic, here are some final thoughts on the paragraph: The P tag is the most important tag in terms of SEO because search engines look at the content of the page, which is created by using multiple P tags, while crawling the content of your website. The more P tags your website has, the higher it may rank. However, it is entirely dependent on the content's quality and uniqueness.

A single paragraph's content should be between 50 and 240 words in length. However, it is not applicable to all topics. Because some topics necessitate in-depth explanation, we must write more words for each paragraph. And some topics necessitate a point-by-point explanation, in which we must write only the words required for each paragraph.

HTML Online Test


« Previous Tutorial Next Tutorial »


Liked this post? Share it!