What are HTML paragraph tags?

In HTML, the <p> tag is used to define a paragraph of text. The text between the opening <p> tag and the closing </p> tag is the content of the paragraph.

For example, the following code defines a paragraph of text:

<p>This is a paragraph of text.</p>

The <p> tag is a block-level element, which means that by default, it takes up the full width of its parent container and creates a new line after it. The text inside the <p> tag is typically rendered with a default margin, to create some separation between the text and other elements on the page.

You can use CSS to style the text within a <p> tag, for example, you could change the font size, color, or add a background color. One way to do this is to assign a class or an ID attribute to the <p> tag and then define the styles for that class or ID in a separate CSS file.

<p class="example">This is a paragraph of text with a class of "example"</p>

.example { font-size: 18px; color: blue; }

Alternatively, you can use the <style> tag within the <head> section of your HTML document to include CSS styles.

<head>
  <style>
    p {
      font-size: 18px;
      color: blue;
    }
  </style>
</head>

You also can style the <p> tag directly without use of class or id, like above mentioned way.

It's important to note that the <p> tag is used for text content specifically, for other types of content like images, tables, lists, or other page elements, other tags are typically used.

Continue Reading