HTML Formatting
HTML formatting elements mark parts of text with a particular meaning, such as importance, emphasis, a highlight, a deletion or a chemical formula. Browsers give most of them a default look, bold, italic or underlined, but the reason to choose one is what it means. Picking the right element helps screen readers, search engines and anyone who later restyles the page.
Meaning versus appearance
HTML has pairs of elements that look the same by default but mean different things:
<strong>marks text of strong importance, such as a warning.<b>draws attention to text without extra importance, like a product name in a review.<em>adds stress emphasis that changes how a sentence is spoken.<i>marks text in an alternate voice, such as a foreign word, a technical term or a ship's name.
Say these sentences out loud: "I never said that" changes meaning with emphasis, so it uses <em>. In "The word jugaad has no direct English equivalent", the word jugaad belongs in <i> because it is a foreign term, not stressed speech.
The formatting elements at a glance
| Element | Meaning | Default look |
|---|---|---|
<strong> | Important, serious or urgent | Bold |
<b> | Draws attention, no extra importance | Bold |
<em> | Stress emphasis | Italic |
<i> | Alternate voice or term | Italic |
<mark> | Highlighted for relevance, like search matches | Yellow background |
<small> | Side comments and fine print | Smaller text |
<del> / <ins> | Removed and added text | Strikethrough / underline |
<s> | No longer accurate, but not an edit | Strikethrough |
<sub> / <sup> | Subscript and superscript | Lowered / raised |
Formatting in a real paragraph
<p>
<strong>Warning:</strong> unplug the device before cleaning.
</p>
<p>
Price: <s>Rs 999</s> Rs 799 <small>(taxes extra)</small>
</p>
<p>
Water is H<sub>2</sub>O and the area of a square is a<sup>2</sup>.
</p>
<p>
Meeting moved to <del>Monday</del>
<ins>Tuesday</ins>.
</p>
<p>Results for "grid": CSS <mark>grid</mark> layout basics</p>
The old price uses <s> because it is no longer accurate, not because a document was edited. The meeting change uses <del> and <ins>, which can carry a datetime attribute recording when the edit happened.
Nesting formatting elements
You can combine elements, for example <strong><em>Do not</em></strong> for text that is both important and stressed. Nesting <strong> inside <strong> signals even greater importance. Close them in reverse order of opening.
Mistakes that undo the meaning
The biggest one is using formatting tags only for looks. Wrapping a whole paragraph in <b> to make it bold, or using <i> for every caption, gives no useful meaning and is harder to change later. If you only want a visual style, use a CSS class such as font-weight: 700 instead. Another mistake is reaching for <u> to underline headings; underlined text looks like a link, which confuses users, and <u> is meant for things like marking spelling errors.
Also avoid the obsolete <font>, <center> and <big> elements found in very old tutorials. They are not part of modern HTML; CSS handles colour, size and alignment.
Rule of thumb
Ask what the text means before choosing a tag: important gets <strong>, stressed gets <em>, highlighted gets <mark>, edits get <del> and <ins>. When the goal is purely visual, write CSS rather than another formatting element.
Ready to master real-world web development?
Learn HTML, CSS3, Bootstrap and JavaScript hands-on with mentor-led sessions.