<u>
u tag
The <u>
tag in HTML is used to underline text. Initially designed for stylistic purposes, it is now mainly used for specific semantic meanings, such as indicating proper names, foreign words, or spelling errors. CSS is generally preferred for underlining text decoratively.
Syntax
<u>underlined text</u>
u
Demo
Today's Special: Salmon
<u>Today's Special</u>: Salmon<br />
<span style="text-decoration:underline;">Today's Special</span>: Salmon
<!-- The <span> tag is used here for underlining as a decorative effect controlled with CSS. -->
<u>
element where text might be confused with a hyperlink.See Also
- Consider using
<span>
,<i>
,<em>
, or<cite>
when applicable. - Use the CSS
text-decoration
property to achieve the previous styling effect of the<u>
element.
Conclusion
The <u>
tag in HTML underlines text but is generally not recommended for styling, as CSS offers more control over text decoration. Instead, it is used for semantic purposes, such as marking proper names, foreign terms, or misspelled words. To prevent confusion, avoid using <u>
for elements that might be mistaken for links.
<tt>
The HTML <tt> element, which is now deprecated, was used to present text in a typewriter or monospace font. Today, the <code> element or CSS is recommended for achieving similar formatting.
<var>
The HTML <var> element denotes a variable in mathematical expressions or programming contexts, usually displayed in italics to signify that its value may vary.