HTML Paragraphs (<p>)

0
2K

HTML paragraphs are defined by the <p> tag. They are used to group related sentences or text into a single block of text. Browsers typically add a blank line before and after a paragraph for better readability.

Basic Structure

HTML
<p>This is a paragraph.</p>

Multiple Paragraphs

HTML
<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>

Important Points

  • Block-level element: A paragraph is a block-level element, meaning it starts on a new line and takes up the full width available.
  • No nesting: You cannot nest paragraphs within each other.
  • Line breaks: To create a line break within a paragraph, use the <br> tag. However, it's generally better to use multiple paragraphs for better structure.

Example with Headings and Paragraphs

HTML
<!DOCTYPE html>
<html>
<head>
  <title>Headings and Paragraphs</title>
</head>
<body>

<h1>This is a Main Heading</h1>

<p>This is the first paragraph under the main heading. It contains some text.</p>

<h2>Subheading 1</h2>

<p>This is the first paragraph under subheading 1.</p>
<p>This is the second paragraph under subheading 1.</p>

<h3>Subheading 1.1</h3>

<p>This is a paragraph under subheading 1.1.</p>

</body>
</html>
Search
Categories
Read More
Education
Immigration timeline 1849-1924
1849: America’s first anti-immigrant political party, the Know-Nothing...
By Modern American History 2024-08-02 16:41:54 0 2K
Technology
Intellectual Property Rights (IPR)
Intellectual Property Rights (IPR) are legal protections granted to creators and inventors to...
By ALAGAI AUGUSTEN 2024-07-13 08:06:43 0 3K
Technology
Cybersecurity
Cybersecurity involves protecting computer systems, networks, and data from digital attacks,...
By ALAGAI AUGUSTEN 2024-07-15 18:06:32 0 3K
Computer Programming
HTML Table Headers: A Comprehensive Guide
HTML table headers are used to define the columns or rows of a table. They are typically styled...
By HTML PROGRAMMING LANGUAGE 2024-09-06 01:31:21 0 2K