<u>
Text with an annotation that can’t be expressed in words, most often a spelling-error mark.
- Display
- inline
- Closing tag
- Required
- Permitted content
- Phrasing content
Example
#<p>
Find the mistakes: this code is
<u style="text-decoration: underline wavy #f43f5e;">unreadeble</u> and has
<u style="text-decoration: underline wavy #f43f5e;">to much</u> repetition.
</p>Definition and usage
#The <u> element marks a piece of text with a non-textual annotation. Most often that’s flagging a spelling mistake, the way a text editor does. It’s also used in Chinese text to mark proper names. Browsers underline such text by default.
In practice, you’ll rarely need it. Underlining on the web is associated with links, so underlined text that can’t be clicked confuses users. <em> is for stress, <strong> for importance, <cite> for titles, and you can set plain underlining in CSS with the text-decoration property.
You can clearly tell spelling errors apart from links with a wavy underline: text-decoration: underline wavy red.
Syntax
#<u>text with an annotation</u>Attributes
#This element has no attributes of its own. It supports the global attributes, such as class, id and hidden.
Default CSS
#Most browsers display this element with these default styles:
u {
text-decoration: underline;
}Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- Don’t underline text for emphasis. Readers will try to click it.
- Mark text added to a document with
<ins>, not<u>. - You can change the underline style in CSS, e.g. to a wavy line for spelling errors.
Related entries
#- <ins>Text added to a document, for example in a new version of a terms page or a corrected article.
- <s>Content that’s no longer accurate, such as an old price. The browser strikes it through.
- <em>Stress in a sentence: a word that, read aloud, is pronounced with emphasis.
- <mark>Highlights a piece of text like a highlighter, because it’s relevant in the current context.
- <a>A link to another page, a file, an email address, or a place on the same page.
Spotted a mistake or missing an example? Write to us.