Given this pared-down test case:
<!DOCTYPE html>
<html><head><title>No Underline Please</title>
<style type="text/css">
li { text-decoration:underline }
li .rule { text-decoration:none ! important }
</style>
</head><body>
<ol><li><span class="rule">RULE</span> CONTENT</li></ol>
</body></html>
I want to underline CONTENT but not underline RULE. However, Chrome, FF, and IE9 all underline RULE. Presumably this is standards-compliant behavior, given that they all agree.
- What spec am I forgetting that is preventing me from overriding the
text-decoration? - How can I achieve the result I want?
Fiddle here: http://jsfiddle.net/F3Grr/
The entire
lielement is being underlined. Theli.rulerule is being rendered, but the underline applies to the entire list item.You should wrap the content you want to be underlined inside another inline element. Here’s one example: