<u> Tag in HTML | Underline Text

The <u> tag in HTML is used to underline text. However, it should be used sparingly as it was originally intended to represent text that is stylistically different, not just for decoration. It is now used primarily for emphasis or when specifying text that should be underlined.

Key Points on <u> Tag:

Syntax of <u> Tag:

Syntax Example

<u>This is underlined text</u>

Example of Using <u> Tag:

This example demonstrates how to underline text using the <u> tag:

Code Example

<u>This is an example of underlined text using the u tag.</u>

Output

This is an example of underlined text using the u tag.

Styling the <u> Tag:

You can also use CSS to underline text instead of relying solely on the <u> tag. Here is an example of using CSS for underlining:

Code Example with CSS

<p style="text-decoration: underline;">This text is underlined using CSS</p>

Output

This text is underlined using CSS

Best Practices for Using <u> Tag:

The <u> tag is useful for underlining text, but it should be used judiciously. For modern web development, CSS provides greater flexibility and control, and it is the preferred method for applying underlines to text.