02 / 07

How to make a text underline ?

Making Text Underlined in HTML

In HTML, you can underline text using the <u> tag or by applying CSS with the text-decoration property. The <u> tag renders text with a simple underline, while CSS provides more control and is the preferred method in modern web development.

Example Using <u> Tag
Example Using CSS Inline Style
Example Using CSS Class
Key Points About Underlining
  1. 1

    Use <u> for simple underlining, but it is not semantic.

  2. 2

    Use CSS (text-decoration: underline) for better control and accessibility.

  3. 3

    Avoid underlining text unnecessarily, as it can be confused with hyperlinks.

  4. 4

    CSS allows more styles, such as overline and line-through.