CSS - underline text

4 points
Created by:

In this short article we would like to show how to create underline text with CSS only.

The style property that makes underline effect on text is text-decoration: underline;.

Practical example:

// ONLINE-RUNNER:browser;

<!doctype html>

    span {
        text-decoration: underline;

  <p>Some text with <span>underline</span> element.</p>


Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.