How to Underline Text in HTML / CSS

2/28/2021

Set the text-decoration style to underline.

Example

HTML Only

Input

<!-- HTML -->
<span>NOT Underlined</span>
<br/>
<span style="text-decoration: underline;">Underlined</span>

Output

NOT Underlined
Underlined

Using HTML and CSS

Input

/* CSS */
.underlined {
  text-decoration: underline;
}
<!-- HTML -->
<span>NOT Underlined</span>
<br/>
<span class="underlined">Underlined</span>

Output

NOT Underlined
Underlined

Tested On

Sources

  1. https://www.w3schools.com/cssref/pr_text_text-decoration.asp

Like This?

for More in the Future

with Comments / Questions / Suggestions