HTML <u> tag (deprecated)S2C Home   « HTML <u> tag

Definition

The <u> tag is used for underlining text.

Underlined text on a web page implies a link so better not to underline your text to avoid confusion.

If you really, really have to underline a non-link use the CSS text-decoration property instead of this tag for future proofed results.

Example


<u>This text will be underlined.</u>

Required Attributes

NONE

Optional Attributes

NONE

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<u class="classname">Underlined text here</u>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<u id="idname">Underlined text here</u>

style - specifies an inline style for the element allowing you to apply the style to the content.


<u style="color:red;text-align:left">Underlined text here</u>

title - specifies extra information about the content.


<u title="information about the content">Underlined text here</u>

Language Attributes

dir - specifies the directional flow of the content.


<!-- The text will flow from left to right -->
<u dir="ltr">Underlined text here</u>

<!-- The text will flow from right to left -->
<u dir="rtl">Underlined text here</u>

lang - specifies a language code for the content of the element.


<u lang="en">Underlined text here</u>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<!-- Executes the go() function -->
<u onkeydown="go()">Underlined text here</u>

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<!-- Executes the go() function -->
<u onkeypress="go()">Underlined text here</u>

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<!-- Executes the go() function -->
<u onkeyup="go()">Underlined text here</u>

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<!-- Executes the go() function -->
<u onclick="go()">Underlined text here</u>

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<!-- Executes the go() function -->
<u ondblclick="go()">Underlined text here</u>

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<!-- Executes the go() function -->
<u onmousedown="go()">Underlined text here</u>

onmousemove - The JavaScript code to be run when the mouse button is moved.


<!-- Executes the go() function -->
<u onmousemove="go()">Underlined text here</u>

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<!-- Executes the go() function -->
<u onmouseout="go()">Underlined text here</u>

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<!-- Executes the go() function -->
<u onmouseover="go()">Underlined text here</u>

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<!-- Executes the go() function -->
<u onmouseup="go()">Underlined text here</u>

go to home page Homepage go to top of page Top