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??
If you think about it, the
supisn’t underlined. but thespanstill is. Since thesupis inside thespan, you see the underline which appears to besup‘s underline.Consider this demo: http://jsfiddle.net/mrchief/DTpEa/24/
You’ll see that the
id1css does take precedence, but you still see the underline which is that of thespan.To solve it, have the
supoutside of thespan: