Text formatting: show importance, emphasis and changes clearly
Some words need extra meaning: an important warning, stress on one part of a sentence or a change from an old time to a new time. HTML has elements for these jobs. This chapter explains the meaning first, then the usual visual result.
Use mark, small, del, ins and s for their intended roles.
Recognise subscript, superscript and annotated text.
Nest formatting elements correctly and keep the message understandable without appearance alone.
Start by asking what the words mean
Formatting often means changing how text appears. In HTML, many text elements also describe why those words are different. That meaning is called semantics. Think of semantics as the job a piece of content is doing.
An urgent instruction and a search match may both attract attention, but they are different kinds of information. Use the element that fits the meaning. If you only want a decorative colour or font, CSS is usually the right tool.
Element
Meaning or role
Common default appearance
strong
Strong importance, seriousness or urgency
Bold
em
Stress emphasis within a phrase
Italic
b
Attention to text without added importance
Bold
i
An alternate voice, term or convention
Italic
mark
Relevance in the current context
Highlighted
small
Side comments or small print
Smaller text
del
Content removed from the document
Struck through
ins
Content inserted into the document
Underlined
s
Content no longer accurate or relevant
Struck through
sub
Subscript required by a convention
Lowered text
sup
Superscript required by a convention
Raised text
u
A non-textual annotation
Underlined
These are common appearances, not fixed promises. CSS, browser defaults and reader settings can change them. Do not choose a meaning only because you like the initial font style.
Strong: mark important information
Use strong when the words have strong importance, seriousness or urgency. It is suitable for a critical reminder in a longer sentence.
HTML fragment — part of a document
<p><strong>Save your work</strong> before closing the editor.</p>
The phrase Save your work is marked as important. The rest of the sentence stays ordinary paragraph text. You do not need to make every word strong to make a notice useful; too much visual emphasis makes the important part harder to identify.
Em: put stress on the intended phrase
Use em when emphasis changes how a sentence should be understood. Stress emphasis means giving particular words extra weight when expressing the sentence.
HTML fragment — part of a document
<p>Explain <em>your own</em> solution before reading the model.</p>
Here, the stress distinguishes the student's own reasoning from a copied answer. Moving em onto a different phrase can change the intended emphasis, even if both versions appear italic.
Assistive tools may expose these meanings differently depending on settings and software. Do not promise that every screen reader always speaks em or strong with a particular voice. Keep the wording itself clear.
B and i: similar appearance, different purpose
B can draw attention to text without giving it the importance of strong. For example, a keyword in a short summary can be set apart. I can mark an alternate voice, a technical term or another appropriate convention without expressing the stress emphasis of em.
HTML fragment — part of a document
<p>Topic keyword: <b>nesting</b>.</p><p>The term <i>metadata</i> refers to information about a document.</p>
B and i are not simply forbidden old spellings. They have roles in modern HTML. Still, use CSS if your only goal is to make an arbitrary sentence bold or italic with no corresponding HTML meaning.
Mark: relevant to this context
Mark identifies text highlighted because it is relevant to the current context. A familiar case is a matching word in search results. It does not automatically mean a warning or high importance.
HTML fragment — part of a document
<p>Your matching topic is <mark>paragraphs</mark>.</p>
This fragment displays a prepared result. Mark does not search the document or calculate matches by itself. A real search feature would need logic elsewhere to find and mark the matches.
Small: a side note, not any text you want tiny
Small is used for side comments or small print, such as a short clarification. It does not remove the need for the note to remain readable.
HTML fragment — part of a document
<p><small>Practice files in this lesson use fictional details.</small></p>
If normal main content just needs a different font size, style it with CSS. Do not put an entire article inside small only to make it fit into less space.
Complete example: a practice reminder
formatting-reminder.html
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><title>Practice Reminder</title></head><body><h1>Before you check the model</h1><p><strong>Save your work</strong> before closing the editor.</p><p>Explain <em>your own</em> solution first.</p><p>Your matching topic is <mark>paragraphs</mark>.</p><p><small>Practice files use fictional details.</small></p></body></html>
Browser previewDocument title: Practice Reminder
This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.
The example uses four different reasons for distinguishing text. Read each paragraph as a message. The first is important, the second stresses whose solution to explain, the third shows a prepared match and the last is a short side note.
Del and ins: show edits to a document
Del marks removed content, and ins marks inserted content. They are useful when a document needs to show an edit history, such as changing a session time.
The old and new times both remain in the document so that readers can compare the change. A line through deleted text is not a privacy tool; the old content is still present in the source.
Del and ins can have attributes such as datetime to record a change time and cite to reference information about the change. Those values do not automatically produce visible explanatory text. The dates and links chapters will revisit their value formats; for now, keep the visible sentence clear about what changed.
S: no longer accurate, rather than an edit record
S identifies content that is no longer accurate or relevant. For example, an old room availability notice may be outdated even if you are not presenting a formal edit to the document.
HTML fragment — part of a document
<p><s>Drop-in seats are available.</s> All seats are now assigned.</p>
The appearance may resemble del, but the role is different. Choose del for a document deletion and s for a statement that is no longer current. Also state the new situation in words so the distinction does not depend only on the line-through style.
Sub and sup: meaningful raised and lowered text
Subscript is text placed lower than the normal text line; superscript is placed higher. Use sub and sup where those positions carry a convention, such as a chemical formula or a mathematical power.
Do not use them merely to move arbitrary labels up and down for decoration. These examples are small notations; they are not a complete system for accessible mathematical expressions. More complex mathematics may need appropriate mathematical markup and explanation.
U: mark an annotation, not a pretend link
U can mark an annotation such as a spelling issue. It is commonly underlined, so it can be confused with a link if used carelessly. Underlining text does not create a destination or make it a working link.
HTML fragment — part of a document
<p>Spelling to check: <u>recieve</u>. The correct spelling is receive.</p>
The explanation makes the annotation understandable without depending only on the underline. For a real link, use an a element with an appropriate destination, which we will learn later.
A second complete example: changes and notation
changed-session.html
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><title>Updated Revision Session</title></head><body><h1>Revision session update</h1><p>Session time: <del>2 pm</del><ins>3 pm</ins>.</p><p><s>Drop-in seats are available.</s> All seats are now assigned.</p><p>Science notation: H<sub>2</sub>O and side<sup>2</sup>.</p><p>Topic keyword: <b>nesting</b>. Term: <i>metadata</i>.</p><p>Spelling to check: <u>recieve</u>. The correct spelling is receive.</p></body></html>
This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.
Look at both the visible words and their source roles. The old time is a deletion, the new time is an insertion and the old availability statement is no longer accurate. The paragraph text explains the updated situation.
Combine meanings without crossing tags
Sometimes a phrase is both important and stressed. Nest the elements and close them in reverse order.
The em element is inside strong, which is inside p. Do not cross the closing tags. Also, do not combine elements only to make every word stand out; choose the smallest phrase that needs the extra meaning.
Ask why the phrase needs attention
1Important? Use strong
2Stressed? Use em
3Contextually relevant? Use mark
4A document edit? Use del and ins
Similar appearance can express different meanings. Keep the words clear without relying only on colour or line-through.
Older tags and modern choices
You may encounter big, tt or strike in older pages or reference lists. They are obsolete for new HTML authoring. Use CSS for arbitrary larger text, appropriate code-related elements for actual code and del or s when their specific meanings fit.
Do not blindly replace every strike with del: first decide whether it means a document edit or an outdated statement. Likewise, small does not simply mean the opposite of an obsolete big element; it has a side-comment role.
Problem and solution: everything is highlighted
Problem: a student wraps every sentence in strong and mark so that readers will notice the whole page.
Solution: decide which sentence is genuinely urgent and which phrase is relevant only in the current context. Mark those parts appropriately and leave ordinary explanation unmarked. Clear wording and meaningful headings do more than making every line visually loud.
Common mistakes and useful tips
Treating strong and b as identical meanings because both look bold.
Treating em and i as interchangeable reasons for italic text.
Assuming mark creates a search feature: it only marks prepared content.
Using small to squeeze all the main content into a small area.
Expecting del to erase private information: the content is still delivered.
Using u to imitate a working link: no destination is created.
Assuming every assistive tool will announce formatting identically.
Copying obsolete tags into new examples without explaining modern replacements.
Practice questions
Which element fits an urgent instruction: strong or mark used only for a prepared search match?
Explain how em differs in meaning from i.
Which two elements show a document's removed and inserted content?
Does deleting text visually with del keep that text secret?
Choose an appropriate element for the 2 in H2O, and explain why u is not a link.
Write a complete schedule update page using one important reminder, one stressed phrase and an old/new time. Keep the changed time clear in words as well as markup.
Check your practice answers
Strong fits the important instruction. Mark expresses contextual relevance, such as the matching search term.
Em supplies stress emphasis. I can identify an alternate voice, a term or another suitable convention without that same stress meaning.
Del and ins respectively.
No. Del marks the content as removed, but it remains in the source delivered to the browser.
Sub places the number in the conventional subscript position. U annotates text and has no link destination by itself.
Use a complete document with strong around the reminder, em around the intended stressed phrase, and del/ins for the edit. Add a clear sentence confirming the current time rather than relying on styling alone.
Interview questions
Why distinguish strong from b?
Strong expresses importance, seriousness or urgency. B draws attention without adding that importance. Similar default appearance does not make their meanings identical.
How do del and s differ?
Del marks a deletion from the document. S marks content that is no longer accurate or relevant. Choose based on what the content means, not simply the desired line-through appearance.
Can text formatting replace clear wording for everyone?
No. Appearance and assistive-tool behaviour can vary. The words should communicate essential meaning without depending only on a colour, underline or one assumed spoken effect.
When should CSS be used instead of a text element?
Use CSS for appearance changes that do not correspond to the meaning of an HTML element. Choose semantic markup when the text really has that role, then style it as needed.
Quick revision
Choose formatting elements by their meaning first.
Strong means importance; em means stress emphasis.
B and i have their own modern roles.
Mark, small, del, ins and s express different reasons to distinguish text.
Sub, sup and u should serve actual content conventions or annotations.
Keep words clear, nest correctly and do not treat visual removal as privacy.