Chapter 5 • Lesson 5.4

Underline: <u> and <ins>

The cardinal rule of web hyperlinks, unarticulated annotations with <u>, and documenting editorial document insertions with <ins>, cite, and datetime.

🎯 Learning Objectives

📖 Mental Model: The Legal Redline & The Spellchecker's Squiggle

In print typography, an underline was a way to tell a typewriter typist to set something in italics. On the web, however, the underline was claimed by Tim Berners-Lee as the universal signal for a clickable hyperlink.

Because of this, HTML5 reserved underlining for very specific non-link scenarios:

1. The Hyperlink Affordance Rule

Since 1991, web users have been conditioned to recognize underlined text as an interactive link. Underlining non-clickable text breaks user expectations, leading to frustrated clicking on "dead" text.

🚨 The Golden Rule of Web Underlines

Never underline plain text simply for visual decoration or emphasis. If you need emphasis, use <em> or <strong>. If you need visual styling, use CSS background colors or borders.

When is <u> Semantically Valid?

In HTML5, the <u> element is officially defined as representing text with an unarticulated, non-textual annotation:

2. Documenting Revisions with <ins>

The <ins> (Insertion) element represents an addition to a document. It is unique in HTML because it can behave as either an inline element or a block wrapper around multiple paragraphs, and it supports two critical metadata attributes:

Attribute Type Description & Example
datetime ISO 8601 Timestamp Records the exact date/time of the insertion: datetime="2026-08-21T09:00:00Z"
cite URL Points to an explanation document, ticket, or legal agreement explaining why the change was made: cite="https://legal.example.com/amendment-v2"

3. Interactive Legal Contract & Spellchecker Lab

Observe how <ins> documents contract additions and how custom CSS styles <u> into a realistic spelling error annotation.

SYS: ACTIVE
HULL: 98%
CORE: STABLE
NET: ONLINE
HTML STARSHIP CODE TERMINAL index.html
LIVE RENDER & DIAGNOSTICS CORE TEMP: 45°C
INSPECTING DOM: VALID
TAGS: SCANNING...

🏋️ Hands-On Exercise: Marking Up a Contract Redline Draft

  1. Wrap the removed subscription price "$49/month" in a <del> element with datetime="2026-08-21".
  2. Wrap the newly inserted price "$39/month" in an <ins> element with datetime="2026-08-21".
  3. Wrap the misspelled word "recieved" in a <u> element with style="text-decoration: underline wavy red;".
  4. Click ▶ Run Code to test your revision markup.
SYS: ACTIVE
HULL: 98%
CORE: STABLE
NET: ONLINE
HTML STARSHIP CODE TERMINAL exercise.html
LIVE RENDER & DIAGNOSTICS CORE TEMP: 45°C
INSPECTING DOM: VALID
TAGS: SCANNING...

⚠️ Pitfall: Accessibility with <ins> and <del>

By default, most screen readers do not announce insertions and deletions in standard reading mode to prevent cluttering speech. For critical legal diffs, pair them with accessible labels or helper text (e.g., <span class="sr-only">Inserted text:</span>).

💡 Pro Tip: Customizing <ins> Styling for Clean Diffs

Browsers default <ins> to a standard underline. In modern web apps (like GitHub diffs), it is customary to remove the confusing underline and use a soft green background:

ins { text-decoration: none; background-color: #e6fffa; color: #234e52; border-bottom: 2px solid #319795; }

📌 Key Takeaways

⭐ LEARN: HTML 🌟 ⚔️ QUIZ BATTLE ARENA // ACTIVE
3x
STREAK!
BONUS ACTIVE
COMBO
? Question 1 / 3

Why is applying standard underlines to non-clickable body text considered bad web design?

Question 1 / 3 Topic: HTML Fundamentals
14:28 REMAINING
XP REWARD
+250 XP
3x
STREAK!
BONUS ACTIVE
COMBO
? Question 2 / 3

Which two attributes are supported by <ins> to document the reason and timing of an editorial change?

Question 2 / 3 Topic: HTML Fundamentals
14:28 REMAINING
XP REWARD
+250 XP
3x
STREAK!
BONUS ACTIVE
COMBO
? Question 3 / 3

Which of the following is a valid semantic use case for the <u> tag in HTML5?

Question 3 / 3 Topic: HTML Fundamentals
14:28 REMAINING
XP REWARD
+250 XP