skip to Main Content

Color gets applied when using :visited pseudo class.

<a href="#" class="footer__link">Company</a>
.footer {
   &__link {
        &:link,
        /*&:visited*/ {
            color: yellow ;
        }
   }
}

3

Answers


  1. you don’t need to nest it or make it any complicated.
    I think this should work for you.

    .footer__link:visited {
      color: yellow;
     }
    
    Login or Signup to reply.
  2. your nesting is completely fine,
    i copied your code and run it in codepen and it worked properly , there are just 2 possibility about the issue

    1. maybe you need to delete that "," after the &:link which is unlikely the issue to be about this part but test it.
    2. your commenting , because in SASS when you comment out something with "//" , the whole line becomes comment and then the first curly bracket becomes as a part of comment and then you declaration fails due to lack of first "{"
    Login or Signup to reply.
  3. You don’t need any extra code, Just copy and paste the below code and it will work just fine.

    .footer {
          /* FOOTER STYLING */
    
          &__link {
             color: yellow;
    
             /* LINK STYLING */
          }
     }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search