HTML - <u> Tag



HTML <u> tag is used to create underline text. 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

<u> ... </u>

Attribute

HTML u tag supports Global and Event attributes of HTML.

Examples of HTML u Tag

Bellow examples will illustrate the usage of u tag. Where, when and how to use u tag to specifies underline text.

Mark up a misspelled word

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

<!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>

Style misspelled word using CSS

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>Simply Esay Learning</h3>
      This paragraph includes a <u class="spelling">wrnogly</u> 
      spelled word.
   </p>
</body>
</html>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
u Yes Yes Yes Yes Yes
html_tags_reference.htm
Advertisements