"text-decoration: none" 不工作,即使有“!重要”
"text-decoration: none" not working, even with "!important"
当我尝试使用类似 underline
的东西时,它可以工作,但 none
没有,即使使用 !important
。有谁知道为什么?
PS: del 元素应该保留在该行中,我正在尝试从这个新的后内容中删除该行。
del:after {
content: attr(datetime);
text-decoration: none !important;
}
<del datetime="2001-01-01">Text</del>
您需要定位 <del>
元素本身而不是 :after
伪元素。
** 编辑 **
根据进一步说明更新。此代码将从伪中删除 text-decoration,但不会删除其余部分。关键是添加 display: inline-block;
.
del:after {
display: inline-block;
content: attr(datetime);
text-decoration: none;
}
<del datetime="2001-01-01">Text</del>
当我尝试使用类似 underline
的东西时,它可以工作,但 none
没有,即使使用 !important
。有谁知道为什么?
PS: del 元素应该保留在该行中,我正在尝试从这个新的后内容中删除该行。
del:after {
content: attr(datetime);
text-decoration: none !important;
}
<del datetime="2001-01-01">Text</del>
您需要定位 <del>
元素本身而不是 :after
伪元素。
** 编辑 **
根据进一步说明更新。此代码将从伪中删除 text-decoration,但不会删除其余部分。关键是添加 display: inline-block;
.
del:after {
display: inline-block;
content: attr(datetime);
text-decoration: none;
}
<del datetime="2001-01-01">Text</del>