Open In App

How to Underline Text using CSS?

Last Updated : 14 Nov, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

To underline a text using CSS, the CSS text-decoration property is used with the value set to underline.

Using text-decoration

We use the text-decoration CSS property to underline a text using CSS. The text that is to be underlined is inserted in a <p> tag and the property is applied.

Syntax

text-decoration: underline;
HTML
<h1>Underlining Text using text-decoration property</h1>

<p>
  	GeeksforGeeks shows the
	<b style="text-decoration: underline;">
    	Underlined part
    </b>using CSS
</p>

Output

underlined-text
underlined-text

Example: Another example display underline text with text-decoration property.

HTML
<h1>Underlining Text using text-decoration property</h1>

<p style="text-decoration: underline;">
	This content is underlined using Text Decoration property
</p>

Output

underlined-text
underlined-text

Next Article
Article Tags :

Similar Reads