Basic Syntax
<p>This is a paragraph.</p>Multiple Paragraphs
<h2>About Codementrix</h2>
<p>Codementrix shares practical programming tutorials
and web development learning resources.</p>
<p>Learners can explore HTML, CSS, JavaScript,
PHP, Laravel and other technologies.</p>Browsers usually display paragraphs as separate blocks with default spacing. The exact spacing and appearance can be changed with CSS.
Does a New Line in the Source Create a New Paragraph?
No. A line break in your source code does not automatically create a new HTML paragraph.
<p>
Learn HTML
with Codementrix.
</p>In ordinary HTML rendering, the text will generally appear as “Learn HTML with Codementrix.” Consecutive whitespace characters are usually collapsed.
To create two paragraphs, use two paragraph elements:
<p>Learn HTML.</p>
<p>Practice HTML every day.</p>Important Paragraph Rules
- A paragraph can contain text and phrasing content, such as
<strong>,<em>, and<a>. - A paragraph must not contain arbitrary flow containers such as a
<div>or another paragraph. - Browsers may automatically close a paragraph when they encounter certain elements that cannot appear inside it.
- Use CSS for visual spacing rather than inserting empty paragraphs repeatedly.
Incorrect:
<p>
Our services
<div>Web development</div>
</p>Better:
<p>Our services include:</p>
<div>Web development</div>4. Bold Text: Strong Importance vs Visual Boldness
HTML provides two commonly used elements for text that appears bold: <strong> and <b>. They have different meanings.
The Strong Element
Use <strong> when the text has strong importance, seriousness, or urgency in context.
<p><strong>Warning:</strong> Save your work before closing the editor.</p>
<p><strong>Important:</strong> Never share your password.</p>Browsers usually display strong text in bold. Its semantic importance is the key distinction.