Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add underline of a <td> text in HTML5

Tags:

html

I am using HTML5, when I use <u></u> tag for underline, it says that it is unsupported by HTML5. What can I use in place of this for underlining?

like image 387
Romi Avatar asked Dec 28 '25 02:12

Romi


1 Answers

You are looking for the text-decoration directive in CSS. As underlined text is a matter of styling and not of layout, it is better relegated to a stylesheet.

Which can be use as such, which will apply the style to all <td> elements on the page

td {
    text-decoration: underline;
}

In CSS if you want a more targeted method of apply style, one way to go about this is with the class attribute of a tag <td class="className">. In CSS classes are defined with a leading full-stop.

.className {
    /* relevant style */
}

so in the case of underlining you specific <td> tags. A method would be:

.underline {
    text-decoration: underline;
}

<td class="underline">Here be underline</td><td>Here not be underline</td> ...

Further information on the form and ussage of CSS can he found at Css Basics

like image 158
zellio Avatar answered Dec 30 '25 15:12

zellio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!