Consider the following code HTML:
<span class='c1'>Home<sup id='id1'>[2]</sup></span>
CSS:
.c1
{
text-decoration:underline;
}
#id1
{
text-decoration:none !important;
}
Now I expected Home
to have an underline while the superscript [2]
doesn't have the underline. But it so happens that the superscript is also getting the underline. What am i missing here??
http://jsfiddle.net/sasidhar/DTpEa/
By setting the text-decoration to none to remove the underline from anchor tag. Syntax: text-decoration: none; Example 1: This example sets the text-decoration property to none.
The style rule em { text-decoration: none; } would not cause any change; the entire paragraph would still be underlined. However, the rule em { text-decoration: overline; } would cause a second decoration to appear on "some emphasized words".
Here I just created a very basic example to illustrate what I was seeing. As it turns out, text-decoration is not one of the properties that can be animated at all, including transitions. So, I went another route. By applying a bottom border instead, I can simulate an underline, and I can animate it.
If you think about it, the sup
isn't underlined. but the span
still is. Since the sup
is inside the span
, you see the underline which appears to be sup
's underline.
Consider this demo: http://jsfiddle.net/mrchief/DTpEa/24/
You'll see that the id1
css does take precedence, but you still see the underline which is that of the span
.
To solve it, have the sup
outside of the span
:
<span class='c1'>Home</span><sup id='id1'>[2]</sup>
Here is a correct variant http://jsfiddle.net/rTUDN/
<div>
<span class='c1'>Home</span>
<sup id='id1'>[2]</sup>
</div>
.c1
{
text-decoration:underline;
}
#id1
{
text-decoration:none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With