KBN
KBN

Reputation: 2974

CSS line-through is not disabled on nested span

CSS :

ol {
    margin: 0 30px;
}
    li {
        margin: 15px 0;
    }
    li.done {
        text-decoration: line-through;
    }
    li.done span {
        text-decoration: none;
        background: #ff0;
    }

HTML :

<ol>
    <li class="done">Hello <span>World</span></li>
    <li>World</li>
</ol>

JSFiddle Demo : http://jsfiddle.net/pZye7/5/ . And something weird on JSFiddle, ordered list's numbers are not displayed.

My requirement : the word "World" should not have the line-through on it.

Upvotes: 3

Views: 1273

Answers (1)

KBN
KBN

Reputation: 2974

li.done span {
    text-decoration: none;
    background: #ff0;
    display: inline-block; /* This solved the problem.*/
}

Reason: Unknown

Upvotes: 4

Related Questions