
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
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>
- Related Articles
- How to remove underline from a link in HTML?
- How to add underline to Text using FabricJS?
- How to strike through and underline text in JavaFX?
- Underline text with CSS
- How to remove underline from text hyperlink using jQuery?
- Underline Text in Tkinter Label widget
- HTML DOM Underline Object
- How to make text bold, italic and underline using jQuery
- How to Change Link Underline Color using text-decoration-color CSS
- How To Extract Text From A HTML Tag In Text Format?
- How to center text in HTML?
- How to Create a Multi-line Text Input (Text Area) In HTML?
- How to add a spellchecker for text in HTML?
- How to display deleted text in HTML?
- How to set Text alignment in HTML?
