HTML - <u>

The HTML Underline Element (<u>) renders text with an underline, a line under the baseline of its content.

Example

<u>Today's Special</u>: Salmon<br />
<span style="text-decoration:underline;">Today's Special</span>: Salmon

Today's Special: Salmon

Today's Special: Salmon

<p><u>All</u> of that is explained in <u>Dive into Python</u></p>

All of that is explained in Dive into Python.

should instead be

<p><em>All</em> of that is explained in <cite>Dive into Python</cite></p>

All of that is explained in Dive into Python.

CSS can be used to style those elements exactly the same, however.

Description  

The HTML Underline Element (<u>) renders text with an underline, a line under the baseline of its content.

In HTML5, this element represents a span of text with an unarticulated, though explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in Chinese text (a Chinese proper name mark), or labeling the text as being misspelled.

Usage Note: As with all purely styling elements, <u> has been deprecated in HTML 4 and XHTML 1, but it has been re-introduced in HTML5 with other semantics. If you want to underline text in a non-semantic manner, you should use a <span> element, or another semantically appropriate element, and style it with the CSS text-decoration property, with the underline value.
Content categories Flow content, phrasing content, palpable content.
Permitted content Phrasing content.
Tag omission None, both the starting and ending tag are mandatory.
Permitted parent elements Any element that accepts phrasing content.
DOM interface HTMLElement Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the HTMLSpanElement interface for this element.

Tips and Notes

Tip: Avoid using the <u> element where it could be confused for a hyperlink.

Note: The HTML 5 specification reminds developers that other elements are almost always more appropriate than <u>.

DOM interface

This element implements the HTMLElement interface.

Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element.

See Also

  • The <span>, <i>, <em>, and <cite> elements are, depending on the case, to be used instead.
  • The CSS text-decoration property is to be used to achieve the former visual aspect of the <u> element.

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/html/element/u