当我尝试使用类似underline
之类的内容时,它会起作用,但none
不起作用,即使使用!important
也是如此。有谁知道为什么?
PS: del 元素应该保留在该行中,我正在尝试从此新内容中删除该行。
del:after {
content: attr(datetime);
text-decoration: none !important;
}
<del datetime="2001-01-01">Text</del>
答案 0 :(得分:1)
您需要定位<del>
元素本身而不是:after
伪元素。
**编辑**
根据进一步指示更新。此代码将从伪删除文本修饰,但不删除其余部分。关键是添加display: inline-block;
。
del:after {
display: inline-block;
content: attr(datetime);
text-decoration: none;
}
&#13;
<del datetime="2001-01-01">Text</del>
&#13;