HTML <u> Underline Tag No Longer Deprecated


ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.

If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)

PDF mobile

The <u> Tag in HTML

Note: Contrary to the reports on other web sites and blogs, the <u> tag is not deprecated in HTML 5 and later. See Changes in HTML 5 below.

The <u> tag is used to visually highlight some content, without imparting any audible emphasis to it. Browsers will normally underline the text inside the u element, which draws the text with a solid underscore line.

In some languages the underline has a special meaning. In Chinese for example, a single straight underline is used to indicate a proper name, which can allow distinguishing one name from others marked in the same manner, and a wavy underline is similarly used to indicate the title of a book or other work of literature.

Here is a demo of HTML code for an entry in a bibliography:

  • Rand, Ayn. Atlas Shrugged. New York: Random House, 1957; New York: Plume, 1999.

This is an actual working example of the <u> tag example code below.

In other contexts, use of the u element is discouraged for a number of reasons:

  1. underlined text that is not clickable can easily be confused with a hypertext link, especially in circumstances when their color cannot be used to distinguish between them
  2. for the separation of style and content, style information should be put into Cascading Style Sheets (CSS)

Therefore, the <u> tag should be avoided when possible. In most cases there are other HTML tags that would be more appropriate:

  • the <b> tag can be used to highlight important words or phrases
  • the <cite> tag can be used to display the title of a book or other creative work
  • the <em> tag can be used to mark up text that is to be emphasized
  • the <mark> tag can be used to mark words or phrases such as search terms
  • the <strong> tag can be used to mark up text that is to be strongly emphasized

Text can also be underlined using the CSS text-decoration: underline property.

<u> Tag Syntax

   ... phrasing content expected ...<u>... phrasing content ...</u>...
Rules for coding the HTML u element

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

  1. Verify that the purpose for using the <u> tag cannot be served better using another tag such as:
  2. Code the u element where phrasing content is expected.
  3. Begin the u element with a starting <u> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  4. Include any HTML global attributes on the <u> tag as appropriate.
  5. Inside the u element, between the starting <u> tag and the ending </u> tag, code the inner HTML phrasing content.
  6. End the u element with a matching </u> closing tag.
Content Model
Content of the uelement

The content of the u element can include HTML comments, text content and only those HTML tags that can be used in phrasing content.

<u> Tag Attributes

Attributes of the <u> tag
global attributes The only attributes that can be coded on the <u> tag are the common HTML attributes.

<u> Tag Examples

Examples of the u tag in HTML
HTML Code for Bibliography Entry
(see <u> tag demo above)
<ul style="margin: 0; list-style: none">
<li>Rand, Ayn. <u>Atlas Shrugged</u>. New York: Random House, 1957; New York: Plume, 1999.</li>

The style="margin: 0; list-style: none" attribute creates the unordered list without bullets, eliminating the margin space where the bullets would normally appear.

Changes in HTML 5 - <u> Tag

The <u> tag was deprecated in HTML 4 and considered invalid in later versions, but has now been added back into the WHATWG HTML Living Standard and W3C HTML 5 (after the two versions diverged - see difference between HTML 5 and HTML Living Standard). Therefore, whether or not the u element is valid depends on the version of HTML:

  • HTML 2 and earlier - <u> tag did not exist
  • HTML 3.2 - <u> tag added
  • HTML 4 - <u> tag deprecated, invalid in HTML 4 strict DTD
  • XHTML - <u> tag invalid
  • WHATWG HTML 5 - u element invalid
  • WHATWG HTML Living Standard - u element added
  • W3C HTML 5 - u element added

Valid HTML 5