Understand HTML Paragraph Structure
In this step, you'll learn the fundamental structure of HTML paragraphs and how to use the <p>
tag to create text sections in web documents. HTML paragraphs are essential for organizing and presenting text content on web pages.
HTML paragraphs are created using the <p>
(paragraph) tag, which defines a block of text. Each paragraph is typically separated by a line break and has some default styling in web browsers.
Let's create a simple HTML file to demonstrate paragraph structure. Open the WebIDE and create a new file called paragraphs.html
in the ~/project
directory:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>HTML Paragraph Example</title>
</head>
<body>
<p>
This is my first paragraph. Paragraphs are used to organize text content
on web pages.
</p>
<p>
Each paragraph is enclosed within opening and closing p tags. The browser
automatically adds some space between paragraphs.
</p>
</body>
</html>
Key characteristics of HTML paragraphs:
- Enclosed within
<p>
and </p>
tags
- Automatically create vertical spacing between text blocks
- Used to group related text content
- Block-level elements that start on a new line
To view the HTML file, you can open it in a web browser. The browser will render the paragraphs with default spacing and styling.
Notes: Learn more about How to preview HTML files in the WebIDE.
Example output in a web browser:
This is my first paragraph. Paragraphs are used to organize text content on web pages.
Each paragraph is enclosed within opening and closing p tags. The browser automatically adds some space between paragraphs.