Eva
Eva

Reputation: 15

CSS code a:visited does not work

I have a pretty noob problem, so I hope someone could help me out.

I have a Blogger blog, and I can't get the links to function like I want to.

I want the links in the post content and in the sidebar - the ones that are a purple shade (#8B7083) and underlined - to look the same for both a:link and a:visited. For some reason visited links turn black, even though I don't have that anywhere in my CSS.

Help me, please?

Upvotes: 1

Views: 122

Answers (1)

Mister Epic
Mister Epic

Reputation: 16743

You do have it in your CSS:

 .popular-posts .item-title a:link, a:hover, a:active, a:visited {
      color: black !important;
      text-decoration: none !important;
 }

Try not to use the !important keyword, it overrides all other styles. Use specificity to determine what styles to apply where: http://css-tricks.com/specifics-on-css-specificity/

Looking at your selectors, I believe you might not be constructing them as you intend. Are you looking for this?

  .popular-posts .item-title a:link, .popular-posts .item-title a:hover,  .popular-posts .item-title a:active, .popular-posts .item-title a:visited

As it stands, your last three segments in your selector (a:hover, a:active, and a:visited) are selecting all links on those pages with those states as you are not constraining them via a descendent selector.

Upvotes: 3

Related Questions