简体   繁体   中英

Override “text-decoration: line-through” for “:before/:after” pseudo class

Do you know why the line-through text-decoration for :before isn't being overridden?

Demo: http://jsfiddle.net/FZJYW/

HTML

<p>Should be strike-through</p>

CSS

p {
  text-decoration: line-through;
}

p:before {
  content: "Should not be strike-through. ";
  text-decoration: none !important;
}

Any ideas how to make only part of text line-through without adding an extra element, like <span> ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM