WordPress.org

Ready to get started?Download WordPress

Forums

I can't make visited links change colour (7 posts)

  1. alanhowesworld
    Member
    Posted 2 years ago #

    I'm a WordPress beginner, constructing a non-blog site link. I'm currently using theme TwentyEleven Child with sidebar (Niraj) - though I may change this. I want visited links on my pages to change colour. I found an instruction to change the style.css file for my theme, and did so ny adding the following at the end -

    #content .entry a:visited {
    color:#f0f;
    text-decoration:underline;
    }
    #content .entry a:hover{color:#f00;}
    #content .entry a:active,#content .entry a:focus {color:#0f0;}

    But it has made no difference. Can anyone help?

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    try either:

    #content .hentry a:visited { ... }

    or:

    #content .entry-content a:visited { ... }

    (there is a small difference between the two - .hentry would include the post title as well...)

  3. alanhowesworld
    Member
    Posted 2 years ago #

    Thanks for the speedy reply, alchymyth. But I've tried both .hentry and .entry-content in place of .entry, and neither of these work either. :-(

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    sometimes you need to clear the broswer cache to get the changes to see immediately - for instance with 'CTRL F5' for PC users.

    i could see the pink color for the visited link; with a hover color of red.
    however, it is also possible that this :focus style
    #content .entry a:active,#content .hentry a:focus {color:#0f0;}
    (green)
    is interfering with the :visited and :hover styles, as it is added after the other styles.

    http://www.w3schools.com/css/css_link.asp

  5. alanhowesworld
    Member
    Posted 2 years ago #

    Thanks again! It all works OK now.

    Seems it's to a certain extent a browser issue. Even with the original ".entry" it works fine in MSIE. In Firefox, it didn't work with ".entry" but worked with ".hentry" once I had cleared the cache - but I had to go into "Options" to do that, F5 did not seem to work.

    The only thing I'd like to know now is where to change the default, unvisited link colour if I wish - it does not seem to be in style.css

  6. alchymyth
    Forum Moderator
    Posted 2 years ago #

    where to change the default, unvisited link colour

    the 'general' link styles are about one-quarter down in style.css of Twenty Eleven:

    /* Links */
    a {
    	color: #1982d1;
    	text-decoration: none;
    }
    a:focus,
    a:active,
    a:hover {
    	text-decoration: underline;
    }
  7. alanhowesworld
    Member
    Posted 2 years ago #

    Many thanks! I need to read up on CSS syntax - I was looking for ":link"!

Topic Closed

This topic has been closed to new replies.

About this Topic