

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to underline a text in HTML?
To underline a text in HTML, use the <u> tag. The <u> tag deprecated in HTML, but then re-introduced in HTML5. Now it represents a text different from another text stylistically, such as a misspelled word.
To underline a text, you can also use the style attribute. The style attribute specifies an inline style for an element. The attribute can be used with the HTML <p> tag, with the CSS property text-decoration.
Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.
Example
You can try the following code to underline text in an HTML page, using the <u> tag
<!DOCTYPE html> <html> <head> <title>HTML u tag</title> </head> <body> <h1>Heading</h1> <p><u>This text will be underlined.</u></p> </body> </html>
Example
You can try the following code to underline text in an HTML page, using the CSS text-decoration property
<!DOCTYPE html> <html> <head> <title>HTML Text underline</title> </head> <body> <h1>Heading</h1> <p style="text-decoration: underline;">This text will be underlined.</p> </body> </html>
- Related Questions & Answers
- Underline text with CSS
- How to remove underline from a link in HTML?
- How to strike through and underline text in JavaFX?
- Underline Text in Tkinter Label widget
- HTML DOM Underline Object
- How to remove underline from text hyperlink using jQuery?
- How to make text bold, italic and underline using jQuery
- How to Change Link Underline Color using text-decoration-color CSS
- How to center text in HTML?
- How to remove underline with jQuery?
- How to Create a Multi-line Text Input (Text Area) In HTML?
- How to add a spellchecker for text in HTML?
- How to underline a Hyperlink on Hover using jQuery?
- How to set text direction in HTML?
- How to set Text alignment in HTML?