gpt4 book ai didi

css - 仅从 anchor 元素子元素中删除下划线

转载 作者:技术小花猫 更新时间:2023-10-29 10:19:38 26 4
gpt4 key购买 nike

a 标签包含子元素时,比如 i 标签,它仍然在悬停时对其应用下划线,我想知道如何删除下划线当有人将鼠标悬停在 a 标签上时,仅来自 i 标签。

我正在使用的 CSS:

a{
display:block;
text-decoration:none;
}
a i{
color:#888;
margin-left:5px;
}
a:hover{
text-decoration:underline;
}
a:hover i{
text-decoration:none !important;
}

这里用fiddle来解释一下: http://jsfiddle.net/kkz66x2q/

我只是希望当您将鼠标悬停在链接上时,下划线只在 i 元素上消失。

最佳答案

尝试遵循 css,

a:hover i{
display: inline-block; <-- this is the trick
text-decoration:none !important;
}

Demo

关于css - 仅从 anchor 元素子元素中删除下划线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25762427/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com