HTML5 <u> Tag – Usage, Attributes and Examples

The HTML <u> element is used to render 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.

The only content permitted inside this element is Phrasing content. Both the starting and ending tag are mandatory for this element. The parent of the <u> tag can be any element that accepts phrasing content.

Just like all other pure styling elements, the <u> tag was deprecated in HTML 4. However, it was then 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.

The following style is applied to this element by default:

u {
  text-decoration: underline;
}

Here is an example of using this tag:

<p><u>Today's Special</u>: Salmon</p>

Attributes

This element only accepts global attributes.

Examples

See the Pen HTML u Tag by Tutorialio (@tutorialio) on CodePen.

Further Reading

  1. Read more about the HTML <u> element on MDN.
  2. You can also read the HTML <u> tag reference on W3C.

Rate this post —

Author: wD94ZrHL

Leave a Reply

Your email address will not be published. Required fields are marked *

0%