Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Span inside td does not override td style

Tags:

html

css

I have a span tag inside a td. The td has a class with CSS to set the text-decoration to underline, while the span sets the text-decoration to none. I expect the text inside the span to not be underlined, but for some reason it is. Why?

.u {
    text-decoration: underline;
}

.no-u {
    text-decoration: none !important;
}
<table>
    <tr>
        <td class="u">
            <span class="no-u" style="text-decoration: none !important;">My Text</span>
        </td>
    </tr>
</table>
like image 667
datadamnation Avatar asked Aug 28 '13 16:08

datadamnation


1 Answers

Cannot remove the underlined style for descendants.

http://www.w3.org/TR/CSS21/text.html#lining-striking-props

The 'text-decoration' property on descendant elements cannot have any effect on the decoration of the ancestor.

like image 92
kcsoft Avatar answered Oct 24 '22 05:10

kcsoft