• Resolved Chi Is Current

    (@jacobbarnett)


    WordPress Twenty Twelve, attempting to change link colors by state, using following code in style.css of child theme:

    a:link {
      color: green;
      background-color: transparent;
      text-decoration: none;
    }
    
    a:visited {
      color: red;
      background-color: transparent;
      text-decoration: none;
    }
    
    a:hover {
      color: yellow;
      background-color: transparent;
      text-decoration: underline;
    }
    
    a:active {
      color: yellow;
      background-color: transparent;
      text-decoration: underline;
    }

    HOWEVER, VISITED link color remains GREY, does not change to RED.
    All other state colors do change as specified.
    Stumped!

    Thank You!!! Jacob

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Chi Is Current

    (@jacobbarnett)

    DISCOVERED elsewhere:

    It means that the rule has been overwritten by another rule (i.e. “a:visited
    color: red;”). There are three way to overwrite a rule:

    1) The overwriting rule is present in the same css file of the overwritten rule, but in a lower position.

    2) The overwriting rule is present in an another css file, linked after the css file containing the overwritten rule.

    3) The overwriting rule is declared inside the html file through the tag or the style attribute.
    —————–
    My rule in CHILD TwentyTwelve style.css is being overwritten by the rule in TwentyTwelve style.css. Getting closer.

    There isn’t another a:visited rule overriding it. The issue is that there is CSS code changing the color of the currently active page in the menu, it is this CSS code

    .main-navigation .current-menu-item > a,
    	.main-navigation .current-menu-ancestor > a,
    	.main-navigation .current_page_item > a,
    	.main-navigation .current_page_ancestor > a {
    		color: #636363;
    		font-weight: bold;
    	}

    So you would have to take that code and insert it into your child theme’s style.css file and choose the color to use there.

    Thread Starter Chi Is Current

    (@jacobbarnett)

    jarret ~

    Thank you for your attention and suggestion. I appreciate your comment, this code is helpful for menu selections.

    Perhaps my original post was unclear.
    I would like to change the color of VISITED page links referenced throughout the site.
    Once the link is visited.

    For instance there is a list of referenced newsletter pages, displayed as dates, here: https://synergycbd.com/newsletter-features/

    In the example above:

    a:visited {
      color: red;
      background-color: transparent;
      text-decoration: none;
    }

    I’d like them to display as red (for testing), not grey…

    Many Thanks ~:~ Jacob

    Ah I see what you mean, try using .entry-content a:visited and it should work then to overwrite properly. So something like this

    .entry-content a:visited {
      color: red;
      background-color: transparent;
      text-decoration: none;
    }
    Thread Starter Chi Is Current

    (@jacobbarnett)

    Jarret ~

    Thank you for your attention and your reply here.
    Adding the above code to my child theme’s style.css results in no change to the page links on https://synergycbd.com/newsletter-features/.

    Still stumped.

    Best Regards, Jacob

    Do you have some type of caching/performance plugin active on the site or possibly on your hosting account?

    Looking at the style.css files that are loading up on the site for me, the following 2 of your child theme are loading:

    https://synergycbd.com/wp-content/themes/twentytwelve-child/style.css?ver=1.0.0
    https://synergycbd.com/wp-content/themes/twentytwelve-child/style.css?ver=5.3.2

    However, neither of those contain the code that I mentioned. Looking at the unversioned style.css file however:

    https://synergycbd.com/wp-content/themes/twentytwelve-child/style.css

    It does contain the code but that unversioned style.css file isn’t being loaded for some reason.

    Thread Starter Chi Is Current

    (@jacobbarnett)

    Jarret ~

    Yes, there was a cacher utility running on the web server, SuperCacher. It is now off while testing.

    Interesting those links brought up different style.css files.(!) Clearly, there should be only one.
    Looking closely at the style.css files, I notice the Theme URI: https://synergycbd.ORG (not .COM).
    I have also updated the version # of the one I’m working with, to avoid unclarity and confusion. -> Version: 1.5.7

    NOW, the link specifications are:

    .main-navigation .current-menu-item > a,                   /*<<< Nav Colors 010120 */
    	.main-navigation .current-menu-ancestor > a,
    	.main-navigation .current_page_item > a,
    	.main-navigation .current_page_ancestor > a {
    		color: #b32d00;
    		font-weight: bold;
    	}
    
    .entry-content a:link {                                   /*<<< Dk Blue 010220 */
      color: #0000A0;
      background-color: transparent;
      text-decoration: none;
    }
    
    .entry-content a:visited {                                /*<<< Lt Orange 010220 */
      color: #ffb84d;
      background-color: transparent;
      text-decoration: none;
    }
    
    .entry-content a:hover {                                  /*<<< Violet 010220 */
      color: #d11aff;
      background-color: transparent;
      text-decoration: none;
    }
    
    .entry-content a:active {                                 /*<<< Yellow 010220 */
      color: yellow;
      background-color: transparent;
      text-decoration: none;
    }

    which all seem to be working well!!! 🙂

    Thank you again for your assistance and perseverance in seeing this to an excellent resolution.

    With Best Regards and Gratitude ~:~ Jacob

    No problem! Glad to hear you were able to get it worked out! 😀

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Visited Link Color Does Not Change per CSS’ is closed to new replies.