The p tag in HTML

What does the p element do in HTML?

If you are new to HTML, p will probably be the first tag you encounter. The p element is used to divide text into blocks. It defines a paragraph of text.
The end of a paragraph is marked with the closing tag /p, which is optional, the closing is implied by the opening tag of the next HTML element. Technically it is recommended to include a closing tag to make the document pass validation.

Beginning
<p>Paragraph</p>
Continued
division of a paragraph with the p tag

By default, most browsers place a line break and a blank line between paragraphs. For finer markup, such as indenting the first line of a paragraph, you should use CSS.

Beginning
<p>Paragraph</p>
Continued
p {
  margin: 0;
  text-indent: 2ch;
}
p.pilcrow {
  text-indent: 1;
  display: inline;
}
p.pilcrow + p.pilcrow::before {
  content: " ¶ ";
}
setting a paragraph indent with CSS

Leave a Comment

Your email address will not be published. Required fields are marked *