对于文本链接,我有:
CSS:
a:link {color: #3366a9; text-decoration: none}
a:hover {border-bottom: 1px solid; color: black}
但这也会在我不想要的可链接 IMG 上添加黑色下划线。
当使用 CSS 悬停时,如何删除可链接 IMG 上的 border-bottom
?
我试过以下方法:
a:hover img {border-bottom: 0px}
但这行不通
Live example (尝试将鼠标悬停在左上角的 Logo 上)
最佳答案
如果您 float 图像而不是内联图像,这将起作用,并且不需要修改史蒂夫的答案所需的图像链接属性。
a:hover img {
border: none !important;
display: block;
}
关于HTML:删除 a:hover for images?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1030544/