订阅到抓虾 Add to netvibes 添加到Google Reader(阅读器) Hosted by exlast.com

超链接样式的正确顺序(link-visited-hover-active)

超链接A的4个CSS属性是有顺序的。
错误的顺序会导致一些问题,例如:超链接访问过后 hover 样式就不出现。

正确的顺序应该为,link-visited-hover-active。

a:link {
color: #676777;
text-decoration: none;
}

a:visited {
color: #676777;
text-decoration: none;
}

a:hover {
color: #90909F;
text-decoration: underline;
}

a:active {
color: #676777;
text-decoration: none;
}

温故而知新:

  • a:link 设置 a 对象在未被访问前的样式。
  • a:visited 设置 a 对象在其链接地址已被访问过时的样式。
  • a:hover 设置 a 对象在其鼠标悬停时的样式。
  • a:acitve 设置 a 对象在被用户激活(在鼠标点击与释放之间发生的事件)时的样式。

延伸阅读:《web标准常见问题集合》

Tags:

相关日志

2 Responses to “超链接样式的正确顺序(link-visited-hover-active)”


  1. 1 Aether

    好像有一个LOVE原则

  2. 2 AmirFish

    @Aether

    :-P

    赫赫,是有这么一个便于记忆的LOVE原则(爱恨原则)

    LoVe/HAte

    即四种伪类的首字母:LVHA

Leave a Reply