1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Problem with A:link, A:visited Inside a Dedicated div

Discussion in 'CSS' started by Traveling, Dec 21, 2009.

  1. #1
    Why am I having problems with this code? A attributes should only apply to links inside a div with .linkies class, but for some reason is also changes all other links on entire site, outside of
    <div class="linkies">
    Code (markup):
    . What did I do wrong there?

    .linkies {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 12px;
    	padding: 10px;
    	color: #999999;
    	text-align: left;
    	margin-left: 14pt;
    	line-height: 1.5em;
    }
    
    .linkies a:link, a:visited {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 14px;	
    	color: #FFFFFF;
    	text-decoration: none;
    	font-weight: bold;
    	}
    Code (markup):
     
    Traveling, Dec 21, 2009 IP
  2. jwitt98

    jwitt98 Peon

    Messages:
    145
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try changing a:visited to .linkies a:visited

    a:visited will affect all a tags
     
    jwitt98, Dec 21, 2009 IP
    kk5st likes this.
  3. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hit it right on the nail. You'd think having them all in the same line would make them mean .linkies but this is how the browser reads your current code:
    
    .linkies a:link {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 14px;	
    	color: #FFFFFF;
    	text-decoration: none;
    	font-weight: bold;
    	}
    a:visited {
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 14px;	
    	color: #FFFFFF;
    	text-decoration: none;
    	font-weight: bold;
    	}
    
    Code (markup):
    BTW while you're at it, why not condense some of that?

    .linkies a {
    color: #fff;
    font: bold 14px verdana, arial, helvetica, sans-serif;
    text-decoration: none;
    }

    You'll only need to state the differences in :hover or :focus then, instead of repeating all the stuff you want to remain the same. "a"'s styles can be inherited by the other pseudo-classes, while a:link's cannot be. Saves a lot of work.
     
    Stomme poes, Dec 22, 2009 IP
  4. Traveling

    Traveling Peon

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That sounds great. Thanks a lot you guys :)
     
    Traveling, Dec 22, 2009 IP