HTML Formatting
HTML provides a small set of elements for marking up text with extra meaning — bold, italic, emphasized, marked, deleted, and so on.
Formatting elements
| Element | Meaning | Renders as |
|---|---|---|
<b> | Visually bold, no extra importance. | bold text |
<strong> | Strongly important. | important text |
<i> | Visually italic — alternate voice, technical term. | italic text |
<em> | Emphasized — stress when read aloud. | emphasized text |
<mark> | Highlighted for reference. | highlighted |
<small> | Side comment or fine print. | small text |
<del> | Deleted text. | |
<ins> | Inserted text. | added |
<sub> | Subscript. | H2O |
<sup> | Superscript. | x2 |
Tip: Prefer
<strong> and <em> over <b> and <i> when the text really is important or emphasized — screen readers change tone for them.Example
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Formatting</title>
</head>
<body>
<h1>HTML Formatting</h1>
<p>This is a demo page for the "HTML Formatting" lesson.</p>
</body>
</html>
Try it Yourself »
Exercise
Make this word semantically important so screen readers stress it.
<p>This is <
>critical</
>.</p>
Stronger than <b>; signals importance.
Discussion
Loading…