The complete guide to underlines (CSS)

All about all... You'll know all about underscores! All right, you recognize the music, don't you? In any case, underlines don't just underline our texts from time to time, they're a real stylization tool, allowing us to add bars below, but also above, in the form of waves, dotted lines, dashes... As you can see, we're going to take a look at all this in this article.
•
Updated on August 14, 2026
•
4 min read
Believemy logo

Everything, everything... You will know everything about underline bars! Well, okay, did you at least recognize the music? Anyway, underline bars are not just limited to underlining our texts from time to time; they are a true styling tool that allows us to add lines below, but also above, in wavy forms, dotted, dashed... As you may have guessed, we will cover all of this in this article.

 

The Multi-Faceted Property

The text-decoration property is the property that has allowed us so far to underline text. You know, with the underline value? Well. But it's not really the only possible value with this property; there are many others. We are actually talking about a property that allows us to decorate the text and not just underline it.

Another important point: text-decoration is a shorthand property! You may be used to using it, but it actually combines:

  1. text-decoration-line - It allows you to define the position of the lines (who said we could only underline?);
  2. text-decoration-color - This allows you to change the color of the line;
  3. text-decoration-style - With the aim of defining the style of the line.

 

Text-decoration-line

The text-decoration-line property, as we have just seen, allows you to define the position of the lines. And it might be the most important thing you will learn in this article (although... at the end, we have a nice surprise for you).

Here are the possible values for text-decoration-line:

  • none - To display no decoration line;
  • underline - To display a decoration line below (to underline);
  • overline - To display a decoration line above;
  • line-through - To display a decoration line through the middle (to strike through).

So? What do you think? We are used to the first two values none and underline, but when it comes to striking through text (line-through) or placing a line above it (overline), it's another story.

And what you might not have known? We can combine these values. For example with:

CSS
text-decoration-line: underline overline;

We display a line below (underline) but also above (overline).

Image

Pretty nice, right? And of course, you can continue by also specifying line-through to have a line above, through, and below.

 

Text-decoration-color

For the text-decoration-color property, we can go faster: it simply allows you to change the color of the lines decorating the text.

CSS
text-decoration-color: #613BDB;

This will allow us to set the lines in purple (Believemy's color).

 

Text-decoration-style

And to finish, the text-decoration-style property will allow us to change the style of the line. For now, it's a bit... linear.

Here are the values we can use with text-decoration-style:

  • double - Displays double lines;
  • solid - Displays a solid line;
  • dotted - Displays dotted lines;
  • dashed - Displays dashed lines;
  • wavy - Displays wavy lines.

Alright, an example for the road to see what wavy looks like:

CSS
text-decoration-line: underline overline;
text-decoration-color: #613BDB;
text-decoration-style: wavy;

Image

Obviously, we have taste.

 

Text-decoration

All these properties are very interesting when used together, resulting in well-decorated elements with a quite original style. But all these properties are lengthy to add... Fortunately, as we saw together, we can use text-decoration to dominate them all at once.

The functionality of the text-decoration property is represented here:

CSS
text-decoration: <text-decoration-line> <text-decoration-style> <text-decoration-color>

If we want to reproduce the previous example, we will have:

CSS
text-decoration: underline overline wavy #613bdb;

Now you know everything about text-decoration and the properties it uses: text-decoration-line / text-decoration-style / text-decoration-color. If you want to learn more about HTML and CSS, we have a complete training dedicated to these two programming languages. Also, feel free to share this article with your friends on your social networks. Thank you!

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating text with integrated background

If you're looking for a very modern and effective way to style your headlines, take a look at how using a background to style the colour of your text can be incredibly innovative.

December 9, 2024

Creating a button with a "fill" effect using CSS

In this article, we'll be taking a look at the secret to achieving this "filling" effect on a button!

December 9, 2024

Creating a cascading animation on text

For a slogan or for an animation on a very important page of your project, this very modern effect is also very easy to achieve. Let's take a look at how to do it in this article.

December 9, 2024

Link CSS to HTML: 3 Methods Explained Simply

Learn the 3 methods to link CSS to HTML: external stylesheet, internal style, and inline. Code examples, best practices, and common mistakes to avoid.

March 22, 2026

How to use suspension points to hide the rest of a text with CSS

This article will enable you to add suspension points to hide text. This is particularly useful when you don't want to break the style of your pages with a long first name or a book-length description.

December 11, 2024

Creating animated borders and rainbow blurs with CSS and JavaScript

Think again: it's not a shadow, it's a trick that will make your visitors think you've added borders and animated rainbow shadows! It's nothing of the sort: no borders or shadows are used in this tutorial. Let's discover the secret behind this trick.

December 9, 2024

Creating an animated list with CSS

Let's find out how to create an animated hover list!

December 9, 2024

Creating a hovered with CSS

In this tutorial we'll look at how to create an overlay easily using CSS!

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.