Horje
HTML <u> Tag

Definition and Usage

The <u> tag represents some text that is unarticulated and styled differently from normal text, such as misspelled words or proper names in Chinese text. The content inside is typically displayed with an underline. You can change this with CSS (see example below). 

Tip: Avoid using the <u> element where it could be confused for a hyperlink!


Browser Support

Global Attributes

The <u> tag also supports the Global Attributes in HTML.


Event Attributes

The <u> tag also supports the Event Attributes in HTML.


How to create HTML <u> Tag

It is marked up a misspelled word with the <u> tag.
index.html
Example: HTML
 <p>This is some <u>mispeled</u> text.</p> 

Output should be:

How to create HTML <u> Tag

How to Use CSS to style misspelled text

The u element + CSS.  This is some mispeled text.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
<style>
.spelling-error {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: red;
}
</style>
</head>
<body>

<h1>The u element + CSS</h1>

<p>This is some <u class="spelling-error">mispeled</u> text.</p>

</body>
</html>

Output should be:

How to Use CSS to style misspelled text

How to set Default CSS Settings on HTML <u> Tag

Most browsers will display the <u> element with the following default values,

A u element is displayed like this:

Some underlined text

Change the default CSS settings to see the effect.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
<style>
u { 
  text-decoration: underline;
}
</style>
</head>
<body>

<p>A u element is displayed like this:</p>

<u>Some underlined text</u>

<p>Change the default CSS settings to see the effect.</p>

</body>
</html>

Output should be:

How to set Default CSS Settings on HTML <u> Tag




html u

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference