【问题标题】:How to un-underline a pseudo element of an element that is underlined如何取消带下划线的元素的伪元素的下划线
【发布时间】:2015-02-06 22:10:10
【问题描述】:

我在工作期间多次遇到此问题,但我一直不明白为什么会发生或如何解决它。

设置:

<p id="skeeter">Even John Skeet cannot parse HTML with Regex</p>

#skeeter { text-decoration: underline; color: blue;}
#skeeter:after { content: "\00bb"; margin-left: 5px; text-decoration: none;}

上面有下划线的raquo,当我不打算这样做时。

小提琴:http://jsfiddle.net/scar1z9k/

【问题讨论】:

    标签: html css


    【解决方案1】:

    this。仅将display: inline-block 添加到:after 标签

    #skeeter { text-decoration: underline; color: blue;}
    #skeeter:after { content: "\00bb"; margin-left: 5px; text-decoration: none; display:inline-block;}
    

    【讨论】:

    • 因为 CSS 中的某些元素没有容器行为,并且某些样式在采取容器行为之前不适用。对不起我的解释,但我的英语不好。对不起
    • @FailedWebDev 可以在这里找到解释:*.com/questions/27137967/…
    最近更新 更多