Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Is there any way to apply a hover style to a visited link with CSS?

Featured Replies

I have a div tag called "footer", which I have applied a link style to (I only want this div tag to have this styling for the links). This is the CSS code I have written.

#footer a:link	{color: #030; text-decoration: underline;}

#footer a:hover	{color: #090; text-decoration: none;}

#footer a:visited {color: #030; text-decoration: underline;}

I want the visited link to be the same colour as the 'normal' link and also have the same styling as the hover link when the mouse moves over it. I have tried deleting the "a:visited" rule, but when I view the page in my internet browser it just shows the default style for visited links. But if I do it as above and view the page in my internet browser, when I hover my mouse over a link that I have visited, it doesn't use the same style as the "a:hover" link (which is what I want it to do).

 

Basically, when you have visited a link, I want it to behave exactly the same as the other links which haven't been visited (using the same styles, even when you hover over it). But I can't get the "a:visited" link, to follow the "a:hover" style.

 

Can it be done?

 

Thank you for any help.

Hi,

First thing is you need to get your link styles in order, a:hover needs to come after a:link and a:visited and to apply a hover state to a visited link is as easy as a:visited:hover, so..

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

 

link specificity - meyerweb(dot)com/eric/css/link-specificity(dot)html

Edited by Wynn

  • Author

Hi,

 

First thing is you need to get your link styles in order, a:hover needs to come after a:link and a:visited and to apply a hover state to a visited link is as easy as a:visited:hover, so..

 

a:link

a:visited

a:visited:hover

a:hover

 

link specificity - meyerweb(dot)com/eric/css/link-specificity(dot)html

Thank you for your help, that worked. It did exactly as I wanted it to.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.