HTML - <u> Tag



The HTML <u> tag is used for the underline tag, which means it underlines the text enclosed within the <u> tag. This tag is generally used to underline incorrect or misspelt words.

The <u> tag is not recommended and ignored because it may cause confusion for hyperlinked text

Syntax

Following is the syntax of <u> tag−

<u>.....</u>

Example

In the following example, we are creating an HTML document and using the <u> tag to underline the wrong word, as follows −

<!DOCTYPE html>
<html>
<body>
   <p>You could use this element to highlight <u>speling</u> mistakes, so the writer can <u>corect</u> them.</p>
</body>
</html>

When we run the above code, it will generate an output displaying the text that is underlined on the webpage.

Example

Considering the following example, we are indicating a spelling error by using the <u> tag and some CSS to display a paragraph that includes a misspelt error, with the error indicated in the wavy underline style.

<!DOCTYPE html>
<html>
<head>
   <style>
      u.spelling {
         text-decoration: red wavy underline;
      }
   </style>
</head>
<body>
   <h2> tutorialspoint </h2>
   <h3> Example of u tag including CSS </h3>
   <p>This paragraph includes a <u class="spelling">wrnogly</u> spelled word.</p>
</body>
</html>

On running the above code, the output window will pop up displaying the text along with a CSS applied to it on the webpage.

html_deprecated_tags.htm
Advertisements