# How to underline a text in HTML?

HTMLWeb DevelopmentFront End Technology

To underline a text in HTML, use the <u> tag. The <u> tag deprecated in HTML, but then re-introduced in HTML5. Now it represents a text different from another text stylistically, such as a misspelled word.

To underline a text, you can also use the style attribute. The style attribute specifies an inline style for an element. The attribute can be used with the HTML <p> tag, with the CSS property text-decoration.

Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.

## Example

You can try the following code to underline text in an HTML page, using the <u> tag

Live Demo

<!DOCTYPE html>
<html>
<title>HTML u tag</title>

<body>
<p><u>This text will be underlined.</u></p>
</body>
</html>

## Example

You can try the following code to underline text in an HTML page, using the CSS text-decoration property

Live Demo

<!DOCTYPE html>
<html>
</html>