×

HTML <u> tag

Underline Element/Tag:

The u tag in html is used to specify the important text or phrase by underline. In earlier HTML versions, this element was known as the "Underline" element, and it is still occasionally used inadvertently in this manner.

You can also use a style with the CSS text-decoration attribute for underlying text.

The u element may be used for a variety of annotations, including correcting spelling errors, highlighting proper names in Chinese text, and so on.

You shouldn't use the u character to visually underline text or to denote book titles.

It is a closed tag that means ending tag is required to close this tag. This tag is represented as <u> tag in html documents

Syntax:

<body>
<p>
……………….
<u>……………. </u>
……………… 
</p>
</body>

Example:

Html:

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This attribute can be used to highlight <u>speling</u>errors, so that the user can <u>corect</u> them all.
</p>
</body>
</html>

Css:

p {
font: 1rem 'Fira Sans', sans-serif;
}
u {
text-decoration: #f00 wavy underline;
}

Output:

Html u Tag

Attributes

Only global attributes are used with this tag.

Global attributes are being supported by this tag. All the event attributes in HTML are also supported by this tag.

Other elements same as U tag:

<em>

This attribute is used to denote stress emphasis.

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This <em>paragraph includes </em> a Wrnogly spelled word.
</p>
</body>
</html>

Output:

Html u Tag

<b>

This attribute is used to draw attention to text.

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This <b>paragraph includes </b> a Wrnogly spelled word.
</p>
</body>
</html>

Output:

Html u Tag

<mark>

This attribute is used to mark key words or phrases.

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This <mark>paragraph includes </mark> a Wrnogly spelled word.
</p>
</body>
</html>

Output:

Html u Tag

<strong>

This characteristic is used to denote the relevance of the text.

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This <strong>paragraph includes </strong> a Wrnogly spelled word.
</p>
</body>
</html>

Output:

Html u Tag

<cite>

If you want torepresent the titles of books or other publications, then you can use this tag in HTML document.

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This <cite>paragraph includes </cite> a Wrnogly spelled word.
</p>
</body>
</html>

Output:

Html u Tag

<i>

In Western writings, this tag is basically used for indicating technical terminology, transliterations, viewpoints, or vessel names.

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This <i>paragraph includes </i> a Wrnogly spelled word.
</p>
</body>
</html>

Output:

Html u Tag

<ruby>

You can add textual annotations with the help of ruby tag in the HTML document.

Utilize the underline value of the text-decoration attribute to impose an underlined look without any semantic significance.

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This <ruby>paragraph includes </ruby> a Wrnogly spelled word.
</p>
</body>
</html>

Output:

Html u Tag

Examples of U tag:

Example 1: For Indicating an error in spelling:

This example uses the <u> element and css code to show a sentence with a spelling problem.

HTML:

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
This paragraph includes a 
<u class="spelling">
Wrnogly
</u>
spelled word.
</p>
</body>
</html>

When the word "wrongly" is spelled incorrectly, the HTML uses the u element with the spelling class.

CSS:

u.spelling 
{
text-decoration: red wavy underline;
}

This CSS specifies that when the class spelling is used to style the u element, then its text is shown by the red underline. This is a typical style for typographical problems. Red dashed underlining can be used to illustrate another typical design.

Output of above code:

Html u Tag

Avoiding u Tag

Most of the times, if you want to avoid u tag, then you can use few instances that demonstrate various situations for specifying something.

Non-semantic underlines

You can use a <span> tag with the text-decoration attribute set to "underline" to highlight text:

HTML:

<!DOCTYPE html>
<html>
<head>
<tile> html u tag </title>
</head>
<body>
<span class="underline">
Today's Episode
</span>
<br>
Almighty gamer as an ultra-instinct guy
</body>
</html>

CSS:

.underline 
{
text-decoration: underline;
}

Output:

Html u Tag

Presenting a book title

You can use cite tag instead of u tag for indicating the titles.

Using the cite element

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
The class read 
<cite>
Moby Dick
</cite>
in the first term.
</p>
</body>
</html>

Result:

Html u Tag

Styling the cite element:

The text is shown in italics by the default style of cite element.

HTML:

<!DOCTYPE html>
<html>
<head>
<title> html u tag </title>
</head>
<body>
<p>
The first book is
<cite>
The secret
</cite>
in the early ages.
</p>
</body>
</html>

CSS:

cite {
font-style: normal;
text-decoration: underline;
}

Output:

Html u Tag

Browser support:

List of browsers that support html u tag are given below:

Chrome: Yes

Microsoft Edge: Yes, version 12 needed

Firefox: Yes, version 1 needed

Safari: Yes

Opera: Yes


Related Topics

How to change text color in HTML

Changing the text colour of a web page is essential because it enhances readability. There are several ways to change the colour of the text in HTML, which are as follows: Text...

7 minutes read.

HTML <address> Tag

Hyper Text Markup Language, HTML is the best markup language for creating Web pages. HTML consists of a wide variety of elements. In all of these elements, one element is...

4 minutes read.

HTML <strong> tag

The strong element in HTML is used to display the real significant information in bold so that the user or reader will understand it easily. Syntax: <p> <strong>………… </strong> </p> Example Here, we will demonstrate how to...

2 minutes read.

HTML Ordered List

We use <ol> tag to make an ordered list in html. An ordered list is made to make a list of items in ordered form, ordered list can be either...

3 minutes read.

HTML &lt;blink> Tag

In HTML, the blink tag is used to create the text which flashes. The blink tag is an inline element in HTML. It is observed that the blink tag used...

2 minutes read.

What does HTML stand for?

HTML stands for Hyper Text Markup Language. We use this markup language to design a web page. Web browsers use this language to showcase text, videos, images, audio and other...

6 minutes read.

HTML <u> tag

Underline Element/Tag: The u tag in html is used to specify the important text or phrase by underline. In earlier HTML versions, this element was known as the "Underline" element, and...

5 minutes read.

HTML <sup> Tag

The HTML sup element is used to describe one or more superscript contents. The sup tag shows a text which is presented above the regular line and half the length...

2 minutes read.

HTML <script> Tag

For embedding a client -side script, we use script tag in html tag. This <script> tag can be used for containing scripting statements. It can also point another external script file...

2 minutes read.

How to add Google Translate Button on your Webpage?

Google translator is a multi-language translator used for translating the webpage. Google develops it. In today's digital age, it is essential because information is available worldwide in some specific language...

5 minutes read.

HTML Search Box

The HTML search box is also known as the search bar. It is an input text field that is used to search the content. If the users want to explore...

7 minutes read.

Font tag in HTML

HTML stands for Hypertext Mark-up Language and is used to create web pages and other information that can be later displayed in a web browser. It also consists of a...

4 minutes read.

HTML Form Input Types

HTML Form Input Types An important element of the HTML form is < input type= "> in HTML. The type attribute of the input element can be of different types, which...

8 minutes read.

HTML <table> tag

The Table element If we want to show the data and information in a two-dimensional table with rows and columns, then we can achieve this by using the HTML element <table>. Syntax: <body> <table> <thead> <tr> <thcolspan="#">………….</th> </tr> </thead> <tbody> <tr> <td>……….</td> <td>……….</td> </tr> </tbody> </table> </body> Example: <!DOCTYPE...

9 minutes read.

HTML Headings

The titles and subtitles of our webpages are known as HTML headings. Let’s not talk about webpages but giving heading to almost everything like normal paragraphs, articles or let it...

2 minutes read.

HTML <source> tag

For media attributes, such as <video> tag, <audio> tag, and <picture> tag, we use the <source> tag in html for adding such type of multiple media html elements in our...

4 minutes read.

HTML Text Format

Introduction HTML may format text in two different ways. The HTML tags define a text property to make it appear one way or another. A text element may also be formatted...

7 minutes read.

HTML <sub> tag

The sub element in HTML is used to describe one or more subscript texts. If The sub tag shows the text which is presented in a smaller font and below...

2 minutes read.

HTML Nested Table

HTML nested table refers to a table that is created inside another table. The table is in the form of rows and columns. From left to right are called horizontal rows,...

5 minutes read.

Div Tag in HTML

In HTML, ‘div’ is a tag that specifies division or section in HTML document. But before going in detail of it, let’s first understand about tags in HTML. The tag...

8 minutes read.