HTML u tag

HTML u tag

Editorial Team
Editorial Team

Follow us on Discord or Telegram to get access to free tutorials and updates.

The HTML u (Unarticulated Annotation) tag is used to represent text in a way that it has a non-textual annotation. By default, any text specified within the u tag will be displayed with a solid underline.

Syntax

<u> Text here </u>

Example

<!DOCTYPE html>
<html>
<head>
    <title>HTML Underline</title>
</head>
<body>
    <p>This is an <u>Underline</u></p>
</body>
</html>

Output

This is an Underline

Applying style

Using CSS, you can change the default style of <u> tag.

Example

<!DOCTYPE html>
<html>
<head>
    <title>HTML Underline</title>
</head>
<body>
    <p>This is<u style="text-decoration: green wavy underline"> Style 1</u>
</p>
    <p>This is<u style="text-decoration: red dotted line-through;"> Style 2</u>
</p>
    <p>This is<u style="text-decoration: blue dashed overline"> Style 1</u>
</p>
</body>
</html>

Output

This is Style 1

This is Style 2

This is Style 1

Many developers misuse this element to display underlined text. To underline text, you should set the CSS text-decoration property to "underline".

Example

<!DOCTYPE html>
<html>
<head>
    <title>HTML Underline</title>
</head>
<body>
    <p>This is an <span style="text-decoration:underline">Underlined</span> text</p>
</body>
</html>

Output

This is an Underlined text