Description
The HTML element <u> is used to specify an underlined text.
It is used just for text formatting and provides no semantic information to browsers.
The below table summarizes its usage.
| Usage Details | |
| Placement | It is displayed as an Inline element. |
| Contents | It can contain Inline elements and text. |
| Tags | Both the opening and closing tags are required. |
| Versions | HTML 3.2, 4, 4.01, 5 This element is deprecated in HTML 4 and redefined in HTML5. However, it's better to avoid using this element in your markup, as it looks like a hyperlink which might confuse users. |
Syntax
Here is the basic syntax of the <u> element.
<u>...</u>
Examples
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example - HTML Element u</title>
</head>
<body>
<p>This paragraph contains an <u>underline text</u>.</p>
<!-- Alternative approach using CSS properties -->
<p>This paragraph contains an <span style="text-decoration: underline;">underline text</span>.</p>
</body>
</html>
Attributes
The following table shows the list of supported and unsupported attributes for the <u> element.
| Attribute Type | Details |
| Element-Specific Attributes | The tag <u> doesn't have any element-specific attributes. |
| Global Attributes | Like all other HTML tags, the tag <u> supports the HTML Global Attributes. |
| Event Attributes | The tag <u> also supports the HTML Event Attributes. |
Browser Compatibility
The tag <u> is supported in all modern browsers.
- Google Chrome 1+
- Internet Explorer or Edge 2+
- Firefox 1+
- Apple Safari 1+
- Opera 4+