Artem Zinoviev Artem Zinoviev - 1 month ago 5x
CSS Question

CSS link border style not working on a:visited

Problem is with link border styles, I can change it on hover, but the border on

doesn't work. Here is example of what I have:

a:link {
color: #536DFE;
text-decoration: none;
border-bottom: dashed 1px;
transition: all .3s ease-out;

a:hover {
border-bottom: solid 1px;
transform: scale(1.08);

a:visited {
color: #727272;
border-bottom: solid 1px;

The problem is the last
border-bottom: solid 1px
is ignored. How can this be fixed?


border-style is not something you can overide on the visited pseudo-class

From MDN

Note: For privacy reasons, browsers strictly limit the styles you can apply using an element selected by this pseudo-class: only color, background-color, border-color, border-bottom-color, border-left-color, border-right-color, border-top-color, outline-color, column-rule-color, fill and stroke. Note also that the alpha component will be ignored: the alpha component of the not-visited rule is used instead (except when the opacity is 0, in that case the whole color is ignored, and the one of the not-visited rule is used).

Also Privacy and the :visited selector