![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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?
Underlined text is used to help draw attention to the text.
We use the <u> tag, to underline a text in HTML. It represents a text in a different style from another text in the content of the web page.
We can also use the style attribute, to underline a text in HTML. The style attribute specifies an inline style for an element. This attribute is used inside the HTML <p> tag, with the CSS property text-decoration property.
Syntax
Following is the syntax to underline a text in HTML.
<u>The content to be underlined</u>
Example
Following is the example program to underline a text in HTML.
<!DOCTYPE html> <html> <head> </head> <body> <p>DLF stands for <u>Delhi Land and Finance </u>. <br> Delhi Land and Finance is one of the largest commercial real estate developer in India.</p> </body> </html>
Example
In the example below, we underlined the text inside the <h1> element.
<!DOCTYPE html> <html> <head> <title>HTML u tag</title> </head> <body> <h1><u>we are underlining the text inside the '<h>' element.</u></h1> </body> </html>
Underlining text by inline CSS
Underlining text using CSS property. This property is used inside the <p> tag.
Syntax
Following is the syntax for underlining a text using CSS property.
<p style="text decoration:underline;">The content to be underlined</p>
Example
Following is the example program to underline a text using CSS property.
<!DOCTYPE html> <html> <head> </head> <body> <p>DLF stands for</p><p style="text-decoration:underline;">Delhi Land and Finance. </p> <p> Delhi Land and Finance is one of the largest commercial real estate developer in India.</p> </body> </html>