HTML Paragraph
The HTML <p> (paragraph) element is used to define blocks of text or content within a web page. It is a fundamental building block for structuring textual information. Here's a detailed guide on the HTML paragraph element:
- Syntax:
- The <p> element has a simple syntax, consisting of an opening tag, content (text), and a closing tag.
- Usage:
- The <p> element is used to group and define paragraphs of text.
- It creates visual separation between blocks of text, making the content more readable.
- Nesting:
- Paragraphs can contain various inline and block-level elements, allowing for the creation of rich and structured content.
- Accessibility:
- Proper use of <p> elements contributes to the accessibility of the webpage, as it aids screen readers in parsing and presenting content to users.
<p>This is a paragraph.</p>
<p>This is a paragraph with <strong> strong</strong> and <em>emphasized</em> text.</p>
Output
This is a paragraph with strong and emphasized text.
Example:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>HTML Paragraph Example</title> </head> <body> <h1>Welcome to My Website</h1> <p>This is the introductory paragraph providing information about the website. </p> <h2 id="details">Details Section</h2> <p>This paragraph contains additional details about a specific section of the website. </p> </body> </html>Output
Welcome to My Website
This is the introductory paragraph providing information about the website.
Details Section
This paragraph contains additional details about a specific section of the website.