Possible Duplicate:
How do I get this CSS text-decoration override to work?
Take a look at this simple example:
<a href="#"> A <span>red</span> anchor </a>
a {
color:blue;
font-family:Times New Roman;
text-decoration:underline;
}
span {
color:red;
font-family:Arial;
text-decoration:none;
}
Live demo: http://jsfiddle.net/5t9sV/
As you can see in the demo on JSfiddle, the SPAN element overrides the color
and font-family
property values of its ancestor ANCHOR element. However, the text-decoration
property does not get overridden for some reason.
I assume that some CSS properties can be overridden by ancestor elements, and some other CSS properties cannot.
Is that so? And if yes, how can I know which ones can and cannot be overridden?
overline
that maybe makes it clearer jsfiddle.net/5t9sV/4 – Giuliettaborder
properties, those also can't be interrupted by settings in child elements. – Giuliettatext-decoration-skip
to deal with this; see my answer. – Basictext-decoration: none-force
or something as a better solution to this – Giulietta