Archived topic
Visited link colour doesn't change
5 replies · Started by Jennifer on March 31, 2023
I have certain blocks where I want to highlight the colour of a visited link.
For those blocks, I have added an additional class in Advanced called "daily-readings-links".
In Additional CSS I have added:
.daily-readings-links a:visited {
color: #E31C3D;
}
This works as intended if I click on the link on the page that contains the block; the visited link turns red and stays red if I leave and return. However, if I visit the page that the link points to some other way and then go look at the link, it is still the original colour.
Is there a way to have the link change colour no matter how the page (that the link points to) was visited?
Edit: There is no option in Appearance > Customize > Colours > Body (or Content) to add a visited link colour, only Initial and Hover.
Hi Jennifer,
However, if I visit the page that the link points to some other way and then go look at the link,
Not sure I understand what this means.
The CSS you are using is the correct way to change the visited link color.
I'm not aware of other CSS for this.
I was under the impression that the URL for a page would register as 'visited' no matter how the page was called up. So you have two pages, as a simple example, with the same link for a third page. I follow one link. On both pages the URL would show as 'visited'. Perhaps I'm crazy and this doesn't happen? Only one page would show the URL as 'visited'?
Edit: other than the blocks where I have specified a colour for visited links (and I have clicked directly from this page), no link on the site shows a different colour if the URL has been visited.
Hi there,
the :visited pseudo selector only applies to the link if it has been clicked on. As the browser records the visited action on click.
And in the theme, we don't apply a visited color.
If you want you can do some CSS like this:
.entry-content p a:visited {
color: #f00;
}
This will apply a visited style to any links within the content of your post.
Got it, thanks!
You're welcome