什么是正确的方法? CSS链接伪类 [英] What is the correct way? CSS Link Pseudo-Class

查看:185
本文介绍了什么是正确的方法? CSS链接伪类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚找到这个:

:a:hover必须来自a:link和a :访问CSS
定义以便生效!



注意:a:active必须来自a:hover在CSS定义中,为了使
生效,



注意:伪类名不区分大小写。 / p>

这是否意味着这是 INCORRECT

  a:link,a:visited,a:active {
color:#006699;
text-decoration:none;
}

a:hover {
color:#2089CC;
text-decoration:underline;很遗憾,源代码是: http://www.w3schools.com/css/css_pseudo_classes.asp =nofollow> http://www.w3schools.com/css/css_pseudo_classes.asp



如果您不知道为什么悲伤,请访问 http://w3fools.com

解决方案

如有任何疑问,请转到规格。下面是规格的摘录。


请注意,A:hover必须放在A:link和A:visited
规则之后,否则级联规则将隐藏A:hover规则的'color'
属性


您所拥有的是正确的

  a:link,a:visited,a:active {
color:#006699;
text-decoration:none;
}

a:hover {
color:#2089CC;
text-decoration:underline;
}

这就是为什么工作。



以下内容不正确。

  a:hover {
color:#2089CC;
text-decoration:underline;
}

a:link,a:visited,a:active {
color:#006699;
text-decoration:none;
}

这就是为什么不工作。


I just found this:

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.

Does this mean that this is INCORRECT?

a:link, a:visited, a:active {
color: #006699;
text-decoration: none;
}

a:hover {
color: #2089CC;
text-decoration: underline;
}

Sadly the source is: http://www.w3schools.com/css/css_pseudo_classes.asp

If you don't know why the 'sadly', please visit http://w3fools.com

解决方案

Whenever in doubt go to the specs. And here's an excerpt from the specs.

Note that the A:hover must be placed after the A:link and A:visited rules, since otherwise the cascading rules will hide the 'color' property of the A:hover rule

What you have is correct

a:link, a:visited, a:active {
   color: #006699;
   text-decoration: none;
}

a:hover {
   color: #2089CC;
   text-decoration: underline;
}

That's why this works.

This below would be incorrect.

a:hover {
   color: #2089CC;
   text-decoration: underline;
}

a:link, a:visited, a:active {
   color: #006699;
   text-decoration: none;
}

That's why this doesn't work.

这篇关于什么是正确的方法? CSS链接伪类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆