HTML Paragraph

The use of an HTML paragraph in writing defines and formats blocks of text on a webpage. Paragraphs are created through the use of the <p> tag, adding spaces before and after the text that separates it visually from the elements on the page.

HTML Paragraph Syntax

<p>This is a paragraph</p>


Key Attributes of HTML Paragraphs
Block-level Element: The tag represents a block-level element – it occupies the entire line width and starts a new line.
Automatic Spacing: Browsers add the default margin above and below paragraphs to enhance readability automatically.
Content Separation Use paragraphs to break content in a logical manner into easily read chunks.
Nesting Rules: A <p> element cannot contain other block-level elements such as <div> or <p> elements. But it can include inline elements suchas <span> or <strong>.

Multiple paragraphs

  • <p>This is the first paragraph of the webpage.</p>
  • <p>This is another paragraph of text, providing more information.</p>
  • <p>You can also style paragraphs using CSS to change their appearance.</p>

How to Style HTML Paragraphs using CSS:

You can apply CSS to change the looks of paragraphs. Here’s one example:

  • <p style=”color: blue; font-size: 18px;”>This paragraph has custom styling.</p>


Accessibility and Usage:
Write meaningful content within <p> tags to enhance readability and accessibility.
Use paragraphs to separate ideas or topics for a clear presentation of content.