HTML <u> Tag
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 >w3wiki</ h1 > < h2 > < u >Tag</ u > </ h2 > < p >w3wiki: A < u >computer science</ u > portal for Beginner </ 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; } .Beginner { font-size: 25px; font-weight: bold; } p { font-size: 20px; } span { text-decoration: underline; } </ style > </ head > < body > < div class = "gfg" > w3wiki </ div > < div class = "Beginner" > < u > Tag </ div > < p >w3wiki: A < span >computer science</ span > portal for Beginner </ 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
Contact Us