dongli7870 2011-07-22 16:23
浏览 51
已采纳

使用CSS设置样式链接

I am trying to give style to my links and I am using this order:

a{}
a:visited{}
a:focus{}
a:hover{}
a:active{}

(I am not using a:link... I just use the id's to make the links work.)

The thing is that my "a" & "a:hover" are working but "a:visited" & "a:active" are not!!! Is there a solution? I am only tying to give different color to "a:active":

a:active{
 font-family: gabriola, verdana; font-size: 26px; color: #e6e8fa; text-decoration: none; vertical-align: middle; border: none; outline: none;
}
  • 写回答

2条回答 默认 最新

  • dqudtskm49788 2011-07-22 16:25
    关注

    active doesn't make sense for non-link anchors (not sure about this actually, :active might be triggered on any visible element). Use this:

    a:link, a:visited               // normal links
    a:link:hover, a:visited:hover   // link with mouse-over
    a:link:active, a:visited:active // link being clicked (mouse-down, etc.)
    

    Also available, but less specific:

    a        // any anchor
    a:hover  // any anchor with mouse-over
    

    The latter two will have their properties overridden by the more specific ones above if the anchor actually has the href attribute set.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?