How to disable color change of anchor tag when visited with CSS?

Spread the love

Sometimes, we want to disable color change of anchor tag when visited with CSS.

In this article, we’ll look at how to disable color change of anchor tag when visited with CSS.

How to disable color change of anchor tag when visited with CSS?

To disable color change of anchor tag when visited with CSS, we set the link’s color to inherit.

For instance, we write

a,
a:visited,
a:hover,
a:active {
  color: inherit;
}

to set the link’s color to inherit after the link has been clicked on with a:visited to keep it the same color after clicking on it.

Conclusion

To disable color change of anchor tag when visited with CSS, we set the link’s color to inherit.

Leave a Reply

Your email address will not be published. Required fields are marked *