为":before /:after"伪类重写"text-decoration:line-through"

Ale*_*lex 5 html css

你知道为什么line-through文本装饰:before没有被覆盖吗?

演示:http://jsfiddle.net/FZJYW/

HTML

<p>Should be strike-through</p>
Run Code Online (Sandbox Code Playgroud)

CSS

p {
  text-decoration: line-through;
}

p:before {
  content: "Should not be strike-through. ";
  text-decoration: none !important;
}
Run Code Online (Sandbox Code Playgroud)

任何想法如何只line-through添加一部分文本而不添加额外的元素,如<span>

Gra*_*rum 9

添加display: inline-block到伪元素的css属性