HTML Underline Text

You have to use u tag to make HTML underline text. However, you can use HTML tags as well as CSS to make the text underlined. It is the HTML formatting tag for the formatting of the text content in HTML.

<u> Tag to Make HTML Underline Text

You have to use the starting tag <u> and the closing tag </u> tag to put text inside it. It is the styling tag that you can use to underline a text.

See the syntax of the tag given below.

Syntax
<u>Enter text content here…<u>

If you want to differentiate the content from the other content, you have to use the styling tag. The HTML <u> tag adds an underline below the text.

Check the example below showing the method and output of the underlined text.

Example

Output

This is an underlined text

The above example showing all the content as underlined. However, you have to make only those content underlined which you want to highlight. Hyperlinks are also gets underlined when you hover over them. This is the default behavior of the anchor link in the standard browser.

To make text underline, you have to first identify the text from the given content. However, using HTML to make the text underlined is no longer recommended. Instead of using HTML, you can use the CSS whose method is given below.

Note: Early versions of HTML like HTML 4 deprecated the <u> tag. However, the recent version HTML5 redefined the tag to use as styling tag for misspelled words

How to Create Underlined Text Using CSS

You can also use the CSS text-decoration property to underline the text content.

To create an underlined text, you have to first assign a class to the text content. After that, use the CSS selector for class(.) to access the text content and apply the CSS. See the below example showing the underlined text using the CSS.

Output

This is the underline text using CSS

The above text showing the underlined text content. Add as many as same styling text as you want using the same class.

Hope, you like this post of how to add underlined text in HTML. If you have any query regarding the tutorial, please comment below.

Also tell me, which method you are using to make the text underlined by commenting below.

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.