I have my span tag:
<span style="text-decoration:line-through" > Hello World <a href="http://www.yahoo.com">Yahoo</a> </span>
As you can see I have applied line-through on span. But this results in line-through on anchor tag too. How do I prevent line-through on anchor tag. I don’t want strike on my anchor tag.
Note: Please don’t ask me to move my anchor tag outside of span tag! If I could do that I wouldn’t be asking this question.
[From CSS text-decoration property cannot be overridden by child element ]
text-decoration specs state:
text-decoration-skip, as mentioned in the linked question is supported by neither the latest version of Chrome, nor Firefox
I don’t know if this is acceptable to you, but since the solution below doesn’t work, this might be your only way to do it:
It is valid to nest span elements. Are nested span tags OK in XHTML?
Doesn’t work:
The property will be inherited by the child by default. If you do not want that, override it.
This will ensure all anchor elements that appear as a direct descendent of a span element will not have a strikethrough.