Paragraphs & Text
p, strong, em, code, and inline elements
Skills taught: html.paragraphs, html.inline-text, html.emphasis
The **p** element wraps a block of text into a paragraph. Each p starts on a new line with a top and bottom margin by default.
<p>HTML stands for HyperText Markup Language.
It is the standard language for creating web pages.</p>
<p>Every website you have ever visited is built on HTML.</p>
Inside paragraphs, **inline elements** add meaning to specific words:
- **strong** — important text (renders bold, announces 'important' to screen readers)
- **em** — emphasised text (renders italic, announces emphasis)
- **code** — inline code or technical terms
- **mark** — highlighted / relevant text
- **abbr** — abbreviation with a title tooltip
- **small** — fine print or side comments
- **del** / **ins** — deleted / inserted text in edits
<p>
<strong>Never</strong> skip heading levels in HTML.
Use <em>semantic</em> elements for their meaning,
not just their looks. The <code>strong</code> tag
signals <mark>importance</mark> to search engines.
</p>
<p>
The <abbr title="World Wide Web">WWW</abbr>
was invented by Tim Berners-Lee.
</p>
Tip:
For longer quoted text, use **blockquote**. For preformatted text (like code blocks), use **pre** wrapped around a **code** element.
<blockquote cite="https://developer.mozilla.org">
<p>HTML is the backbone of the web.</p>
</blockquote>
<pre><code>function greet(name) {
return `Hello, ${name}!`;
}</code></pre>
Frequently Asked Questions
Can I put a div inside a p?
No. p can only contain inline content (text, strong, em, code, etc.). Placing a block element like div inside p is invalid HTML and browsers will auto-correct it in unpredictable ways.
What is the difference between em and i?
em conveys stress emphasis (semantic). i is purely presentational italic with no additional meaning — use it for technical terms, foreign words, or titles by convention, not for emphasis.
How do I add a line break inside a paragraph?
Use the br element sparingly — only for content where line breaks are meaningful (like poetry or addresses). For layout spacing, use CSS margin/padding instead.