HTML / HTML Tags

HTML <U> Tag

Dec 12, 2022
2 min read
HTML u Tag

Definition

A <u> tag represents a span of text that is unarticulated and rendered with a non-textual annotation, such as underlining misspelled words with a red underline. It carries semantic meaning.

Example

<p>The Webmaster is a great place to <u>learn</u> HTML.</p>

Usage

  • Both the opening and closing tags are required.
  • The <u> element can be used in any elements that permit phrasing content.
  • The <u> element can contain phrasing content.
  • This is not to be confused with the old <u> element in HTML 4 that represented simple underlined text. The new HTML 5 meaning has semantic meaning, as per the definition above.

Attributes

The U element only supports the Global Attributes.

Best Practices

  • The default rendering of the <u> element is underlined text. This can clash with the conventional rendering of hyperlinks. It is recommended that you either change the styling of one of the two elements with CSS to avoid confusion.

    For example, to style the <u> element with red wavy lines use the following CSS:

    u {
    text-decoration: red wavy underline;
    }

  • According to the HTML Specifications, in most cases an alternative element is likely to be more appropriate. For example:

Specification

Browser Support

Desktop

ChromeEdgeFirefoxIEOperaSafari
YesYesYesYesYesYes

Mobile

Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet
YesYesYesYesYesYes