gpt4 book ai didi

css - css 链接的一个特殊问题

转载 作者:太空宇宙 更新时间:2023-11-04 04:45:41 25 4
gpt4 key购买 nike

我的网站上有链接的 CSS 代码:

a { text-decoration:none; color:#2B5384; }
a:hover { color:#F90; }
a:visited { color:#2B5384; }

如果链接看起来像这样就可以正常工作:<a href="mypage.html">My page</a> - 链接的颜色为深蓝色,悬停时变为橙色并出现下划线。但是,如果我链接到外部网站,例如 <a href="http://www.facebook.com/mypage">My page</a> - 悬停时链接不会改变颜色,也不会出现下划线。如果我将 URL 更改为具有 .html 扩展名,它会起作用 - <a href="http://www.facebook.com/mypage.html">My page</a> ,但是,显然,没有这样的页面。

为什么会发生这种情况,如何解决?

最佳答案

参见 http://www.w3schools.com/css/css_pseudo_classes.asp特别是注释:

Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!

Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!

Note: Pseudo-class names are not case-sensitive.

这是 w3c 的官方版本 http://www.w3.org/TR/CSS2/selector.html见 5.11.3 节

关于css - css 链接的一个特殊问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14547876/

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