<u>

Term side of the Card.
Topic: Formatting
Unit title: <u>
Categories: Tag
Explanation side of the Card

Explanation: The element that renders text with an underline. It's often used to indicate misspelled words, proper names in Chinese text or to draw attention to specific content.

Browser compatibility:
  • The chrome browser supports this feature starting from version 1.
  • The edge browser supports this feature starting from version 12.
  • The firefox browser supports this feature starting from version 1.
  • The safari browser supports this feature starting from version 4.
Availability: 

Example

Wronghtml
<p>
  This is <u>very</u> important.
</p>
Righthtml
<p>
  This is <em>very</em> important.
</p>

Emphasis needs <em>, and underlined text looks like a link and confuses users.

Common mistakes

  • Using <u> for emphasis, so users try to click it as a link.

Key points

  • <u> marks a non-textual annotation, like a spelling error mark, not emphasis.
  • Plain underline styling uses CSS text-decoration, not <u>.
  • Underlined text that is not a link is styled so it does not look like a link.

Interview questions

Is the u tag deprecated?

No, <u> is valid HTML with a narrow meaning: an unarticulated annotation, such as marking a misspelled word.

How do I underline text without u?

Use CSS text-decoration: underline, and tune it with text-underline-offset and text-decoration-thickness.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy