HTML Paragraph
An HTML paragraph is a block-level element used to display a block of text on a webpage. It's created using the <p>
tag. Each paragraph element creates some space before and after the text, separating it from other elements on the page.
Basic Example
Here's a simple example of an HTML paragraph:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Paragraph Example</title>
</head>
<body>
<p>This is a simple paragraph. It is enclosed in <p> tags.</p>
</body>
</html>
Multiple Paragraphs
You can have multiple paragraphs in a document, each enclosed in its own <p>
tag:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Multiple Paragraphs</title>
</head>
<body>
<p>This is the first paragraph. It introduces the content.</p>
<p>This is the second paragraph. It provides additional details.</p>
<p>This is the third paragraph. It concludes the discussion.</p>
</body>
</html>
HTML Paragraphs with Formatting
You can include formatting tags within paragraphs, such as <strong>
, <em>
, and others:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Formatted Paragraph</title>
</head>
<body>
<p>This paragraph contains <strong>strong</strong> and <em>emphasized</em> text.</p>
</body>
</html>
Important Points
- Whitespace Handling: HTML collapses multiple spaces into a single space. If you need to preserve whitespace, consider using CSS or HTML entities like
. - Line Breaks: To insert a line break within a paragraph, you can use the
<br>
tag, though this is usually better handled with CSS for styling purposes.
Feel free to ask if you have more specific questions or need examples!
At Online Learner, we're on a mission to ignite a passion for learning and empower individuals to reach their full potential. Founded by a team of dedicated educators and industry experts, our platform is designed to provide accessible and engaging educational resources for learners of all ages and backgrounds.
Terms Disclaimer About Us Contact Us
Copyright 2023-2025 © All rights reserved.