HTML <u> Tag
Last Updated :
13 Dec, 2023
The HTML <u> tag stands for underline which helps to underline the text enclosed within the <u> tag. Underlining the text is mainly done to indicate the unarticulated or styled differently from normal text, i.e. to denote the misspelled words. The HTML <u>
tag is supported by HTML4.1 but deprecated in HTML5. To achieve the same, the CSS text-decoration property can be used by setting its value as underline.
Syntax
<u> Contents... </u>
Note: The <u>
 tag supports the Global Attributes and Event Attributes in HTML.
Example 1:Â The below examples illustrate the <u> tag in HTML.
HTML
< html >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >
< u >Tag</ u >
</ h2 >
< p >GeeksforGeeks: A
< u >computer science</ u >
portal for geeks
</ p >
</ body >
</ html >
|
Output:
Example 2: Alternate way of using HTML <u> tag to underline the text.Â
HTML
< html >
< head >
< title >u Tag</ title >
< style >
body {
text-align: center;
}
.gfg {
font-size: 40px;
font-weight: bold;
color: green;
}
.geeks {
font-size: 25px;
font-weight: bold;
}
p {
font-size: 20px;
}
span {
text-decoration: underline;
}
</ style >
</ head >
< body >
< div class = "gfg" >
GeeksforGeeks
</ div >
< div class = "geeks" >
< u > Tag
</ div >
< p >GeeksforGeeks: A
< span >computer science</ span >
portal for geeks
</ p >
</ body >
</ html >
|
Output:Â
Supported Browsers
- Google Chrome 1 and above
- Edge 12 and above
- Firefox 1 and above
- Opera 15 and above
- Safari 4 and above
Â
Share your thoughts in the comments
Please Login to comment...