Skip to content Skip to sidebar Skip to footer

.current Link Styling On Css Only Works On The 1st Page And Doesn't Transfer To The Other

So the css that I have works for both html pages, however, the current link styling only works on the first page and doesn't transfer to the 2nd page when clicked. Do you know why

Solution 1:

Please try below css for get link in second page. You need to put "a:visited" property.

<styletype="text/css">li.current > a:link {
        border-bottom: 0.3px solid green;
        color: red;
    }
    li.current > a:visited {
        border-bottom: 0.3px solid green;
        color: red;
    }
</style>

Solution 2:

The behavior you're seeing is expected. The :link pseudo-class refers to links that have never been visited. By definition, the user must have clicked the link to the current page to get to it, so it will not be selected by :link.

You need to use li.current > a:visited.

Post a Comment for ".current Link Styling On Css Only Works On The 1st Page And Doesn't Transfer To The Other"