HTML - <u> Tag



Introduction to <u> Tag

The HTML <u> tag is used to create underline text. This tag is generally used to underline incorrect or misspelled words.

The <u> tag is not recommended and is often ignored because it can cause confusion with hyperlinked text

Syntax

Following is the syntax of <u> tag −

<u> ... </u>

Attributes

The HTML <u> tag supports Global and Event attributes.

Example: Correcting a Misspelled Word

In the following example, we create an HTML document and use the <u> tag to underline incorrect words. This HTML code creates a paragraph with underlined text, highlighting the misspelled words "spelling" and "correct" for correction.

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

Example: Styling Misspelled Word

Considering the following example, we indicate a spelling error using the <u> tag and CSS to display a paragraph with a misspelled word, highlighted with a 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