HTML PARAGRAPH
Syntax
Example of HTML Paragraph
-
<p>The opening tag that starts the paragraph. -
</p>The closing tag that ends the paragraph. - Content The text or other elements placed between the opening and closing tags.
Example :
Key Points About HTML Paragraphs
1. Automatic Spacing:
- Browsers automatically add space before and after a paragraph element, separating it from other elements.
- This spacing helps improve readability.
2. Block-Level Element:
-
The
<p>tag is a block-level element, meaning it takes up the full width available and starts on a new line.
3. Nesting and Content:
-
HTML paragraphs cannot contain block-level elements (such as
<div>,<header>,<footer>) directly. However, they can contain inline elements like<span>,<a>or<strong>.
4. Line Breaks:
-
To add line breaks within a paragraph, use the
<br>tag. This is helpful for breaking lines without starting a new paragraph. - This spacing helps improve readability.
Example for line break :