What is the tag to underline text in HTML 5?
-
- Rank 0 - Newcomer
- Posts: 1
- Joined: Sat May 12, 2012 5:19 pm
What is the tag to underline text in HTML 5?
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?
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: What is the tag to underline text in HTML 5?
Hello,
The HTML5 specification says:
Also see:
https://www.htmlvalidator.com/help.php? ... decoration
I hope this helps!
The HTML5 specification says:
Using CSS you can use: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.
Code: Select all
text-decoration: underline
https://www.htmlvalidator.com/help.php? ... decoration
I hope this helps!
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank 0 - Newcomer
- Posts: 6
- Joined: Sat Aug 25, 2012 8:06 am
Re: What is the tag to underline text in HTML 5?
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;}.
<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;}.
-
- Rank 0 - Newcomer
- Posts: 1
- Joined: Sat Sep 01, 2018 10:56 am
Re: What is the tag to underline text in HTML 5?
The <u> tag works just fine in HTML5