Skip to main content

HTML Tags

HTML <u> Tag

Written by Updated HTML <u> Tag exercises

The u tag draws a line under text. Because links are underlined too, readers will try to click it. So u has a narrow job today: marking text that is unusual in some way, like a spelling mistake.

What u means in HTML5

In early HTML, <u> just meant "underline". HTML5 kept the tag but gave it a meaning: an unarticulated annotation, text marked as different without stressing it. The classic examples are spelling mistakes (the red squiggle in a word processor) and proper names in some Chinese texts.

If you want an underline only for looks, use CSS text-decoration: underline, explained in CSS Text Decoration.

Syntax

html

<u>Underlined text here</u>

There are no special attributes, only the global ones such as class, id, style and title.

Example

Marking spelling mistakes with u

html

<!DOCTYPE html>
<html>
<head>
  <title>U Tag Example</title>
  <style>
    u.spelling {
      text-decoration: red wavy underline;
    }
  </style>
</head>
<body>
  <h1>HTML &lt;u&gt; Tag Example</h1>
  <p>
    Please check this sentence: I <u class="spelling">recieved</u> the
    parcel <u class="spelling">yesturday</u>.
  </p>
</body>
</html>

The two misspelled words get a wavy red underline, just like in a word processor. Plain <u> would give a straight line.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Good to know

  • Do not use <u> for emphasis. Use <em> for stress or <strong> for importance.
  • Do not underline text that is not a link, unless you style it so it clearly does not look like one, as with the wavy line above.
  • For titles of books or films, use the cite tag instead.

HTML <u> Tag exercises

Mark a misspelling

Write this paragraph and mark the misspelled word recieve: He wrote recieve again. Use the element made for marking text in a way that is not stress or importance.

Result

Check your answer to see it here.