简体   繁体   中英

Styling links using 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;
}

I read somewhere (a quick Google suggests it could have been anywhere ) that it's easy to remember the order for anchor styling declarations using the mnemonic L o V e / HA te:

a:link
a:visited
a:hover
a:active

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM