In HTML, paragraphs are defined using the <p>
tag. The basic structure of a paragraph in HTML is:
<p>Your text goes here.</p>
Key Points:
- Syntax: The
<p>
tag is a block-level element that automatically adds a blank line (or space) above and below the paragraph. - Multiple Paragraphs: You can add as many
<p>
tags as you need in a document. For example:<p>This is the first paragraph.</p> <p>This is the second paragraph.</p>
- Nested Elements: You can include other inline elements, such as
<strong>
,<em>
, or<a>
, inside a paragraph:<p>This is a <strong>bold</strong> word in a paragraph.</p> <p>Visit <a href="https://example.com">this website</a> for more information.</p>
- Breaking Lines: Use the
<br>
tag for line breaks within a paragraph:<p>This is a paragraph with a line break.<br>Here is the next line.</p>
Example of Paragraphs in a Full HTML Document:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Paragraphs</title>
</head>
<body>
<p>This is the first paragraph of the document.</p>
<p>This is the second paragraph, which contains <strong>bold text</strong> and a <a href="https://example.com">link</a>.</p>
<p>Here is a paragraph with a line break:<br>See the second line?</p>
</body>
</html>
Let me know if you'd like help with formatting or more advanced paragraph features!
No comments:
Post a Comment