Page 1 of 1

What is the tag to underline text in HTML 5?

Posted: Sat May 12, 2012 5:22 pm
by parkerchuks
The tag that I am familiar with <u></u> to underline text is no longer valid in HTML 5, and has become outdated. How then, in the new HTML 5 language, do you underline text?

Re: What is the tag to underline text in HTML 5?

Posted: Sun May 13, 2012 7:55 am
by Albert Wiersch
Hello,

The HTML5 specification says:
Use appropriate elements and/or CSS instead.

Where the tt element would have been used for marking up keyboard input, consider the kbd element; for variables, consider the var element; for computer code, consider the code element; and for computer output, consider the samp element.

Similarly, if the u element is being used to indicate emphasis, consider using the em element; if it is being used for marking up keywords, consider the b element; and if it is being used for highlighting text for reference purposes, consider the mark element.

See also the text-level semantics usage summary for more suggestions with examples.
Using CSS you can use:

Code: Select all

text-decoration: underline
Also see:
http://www.htmlvalidator.com/help.php?m ... decoration

I hope this helps!

Re: What is the tag to underline text in HTML 5?

Posted: Sat Aug 25, 2012 8:20 am
by worrall
According to me we can use the <u> tag for underlining text in html5 if this is not working you can go through css coding also, i just tried an example u go through this which is as follows...
<span style="text-decoration: underline;">text</span>.
This would be some extra code, you can store it in a css class {.underline text-decoration: underline;}.

Re: What is the tag to underline text in HTML 5?

Posted: Sat Sep 01, 2018 10:59 am
by Stella365
The <u> tag works just fine in HTML5