HTML underline

You can use HTML underline element to make any text or word look different or to get the visitor’s attention inside a paragraph. There are 2 ways to underline in HTML, one is with the <u> tag and the other with the CSS property. So let’s know how to underline in HTML.

<div>
	<p>How to <u>underline</u> in HTML </p>
	<p>How to <span>underline</span> in HTML </p>
</div>


span{
	text-decoration: underline;
	text-decoration-color: red;
}

/ ***** Other Example ****** /

<div>
	<p>How to <span class=”underline”>underline</span> in HTML </p>
</div>

.underline{
	border-bottom: 2px dashed;
	border-bottom: 2px dotted;
	border-bottom: 2px solid;
}

How To Highlight Text

If you want to highlight your text, then you have to use the <mark> tag.

<div>
	<p>I want to <mark>highlight</mark> my text </p>
</div>

When you use the <mark> tag, it will make your word’s background yellow. But if you want to use some other color instead of yellow, then for that you will have to see the example given below.

<div>
	<p>I want to <mark class=”myword”>highlight</mark> my text</p>
</div>

.myword {
	background-color: red;
	color: #fff;
	padding: 5px;
}

Browser Support

  • Edge
  • Firefox
  • Internet
  • Explorer
  • Opera
  • Safari
  • Chrome

Frequently Asked Questions

We have answers to some questions that people search on the Internet everyday. Let us know what are those questions and what are their answers.

What is an underlining?

Text can be shown differently by underline the words inside the paragraph.

What is B tag in HTML?

The B tag is used to make a word or text bold.

How do you center HTML?

You can use CSS property text-align center to center the text.

How do you italicize in HTML?

You can italicize your text by using the <i> tag.

What does HR mean in HTML?

The HR <hr> element is used to draw lines.

Where do I put CSS in HTML?

There are 3 ways to apply CSS, either you can link your file inside the head tag, or you can add inline CSS, or you can place your CSS on the same page with the style tag.

How do you underline in HTML?

With u tag you can underline your text.

Note: All the examples shown in this article, we have tested before, you can use these examples without any difficulty.

Related: 4 Tremendous Examples Of HTML Header