Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Changing link color on focus but not on click (either mouse or keyboard click)

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #206177
    limbi
    Participant

    Hi

    I want to change the color of a link when a user focuses on it by navigation to it using the TAB key. that’s the easy part, as it’s done by this:

    a:focus{ color: red; }
    the problem is, the link is also colored red when activated, e.g: when a user clicks the “ENTER” key or the left mouse click.

    How can I prevent this side effect and keep the coloring only when user focuses on the link using the “TAB” key ?

    I tried this:

    a:focus{ color: red; }
    a:active{ color: blue; }
    (blue is the default color) it didn’t work, what happens is it first turned the link blue but then red in a slit second…

    I need this done of every link on my site so I don’t want to use any complicated javascript code to do this and hoping to do this in CSS only.

    any suggestions ?

    #206200
    Paulie_D
    Member
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.