Creating Underline Text In HTML (With Or Without CSS) | All Global Updates

Creating Underline text in HTML (With or Without CSS)

Creating Underline text in HTML (With or Without CSS);-in This post you will Learn how To Create Underline text in HTML With or Without CSS.

Creating Underline text in HTML

In this article, we will providing you an example to create text with underline using HTML and CSS and using plain HTML also. Using Underlines below text, we can bring attention of our readers. But we should use underline text with caution, as generally underlined text in websites are links.


We can create Underlined text in HTML in two ways

  1. Using CSS, text-decoration property
  2. Using <u> HTML tag inside <p> or <div>
  3. Using “border-bottom” in CSS

Let’s take a look at both ways, with examples, one by one.

Underline Text using plain HTML

You can simply use <u> tag in HTML to underline the text.

For example:

<h2> <u> This h2 is underlind. </u> </h2>

You will see output as below


Now, as you see this is very simple approach to underline the text, but I think it would be much better to use CSS. Why?

Because using CSS, you can have better control over this underlined text.

You can change color of underline, using CSS you can also change style of underline.

Underline Text using CSS

As mentioned, above we have better way to underline text which is done using CSS’s “text-decoration” property, which gives more control over underline styling, color etc.

<h2> <u> This is underlined using the u tag. </u> </h2>
<p class="firstUnderline"> This is underlined using CSS text-decoration </p>
<p class="SecondUnderline">  One more Using CSS text-decoration complete </p>
<p class="ThirdUnderline">  One more Using CSS text-decoration-line.</p>
<p class="UnderlineOverline">  One more Using CSS but this time overline also. </p>



  text-decoration:underline wavy green
  text-decoration: underline overline;

The text-decoration property specifies the decoration added to text, and is a shorthand property for:

  • text-decoration-line (required)
  • text-decoration-color
  • text-decoration-style

In the above examples, we are using all ways to underline text using CSS, using text-decoration short hand property or using text-decoration-line property.

One of the drawbacks of using text-decoration is you can not change thickness of underline.

So, if you want to underline text and modify it’s thickness also, you can “border-bottom” CSS property, which allows us to modify thickness of underline also.

Underline using “border-bottom” CSS property


  <span class="simpleUnderline">Underlined using Border-bottom</span>

  <span class="Dottedunderline">Dotted underline with 5px height</span>

  <span class="simpleUnderline underline--blue">Wrapping text across lines</span>


.simpleUnderline {
  border-bottom: 2px solid currentColor;

  border-bottom: 5px red dashed;
.underline--blue {
  border-bottom-color: blue;


Avatar Of Allglobalupdates
All global Updates was established in 2017, and since then we have developed into a renowned group of passionate Content Creators. We concentrate on newsworthy topics in the fields of Finance, Tech, education, Business, Careers, entertainment, and sports. We also create captivating human interest stories and informative content.