Results 1 to 6 of 6

Thread: colored links inheriting property values

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,718
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default colored links inheriting property values

    How can I get the links to not inherit the properties of the body. For some reason the top link behaves correctly, but with the wrong color while the second one has the right color, but now the javascript does not work.

    I am rusty and am not sure what I am doing wrong.

    Thanks

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <
    style type="text/css">
    body {
        
    background-color#000000;
    }

    a:link {
        
    color#000000;
    }
    a:visited {
        
    color#666666;
    }

    .
    style9 {
    color:          #9900CC;
    visited:        #9900CC;
    }
    -->
    </
    style></head>
    <
    script src="http://i.thottbot.com/power.js"></script>
    <body>
    <div align="center"><a href='http://thottbot.com/i30247'>Leggings of the Vanqud Hero x2</a><br>
    <a href='http://thottbot.com/i30090'><span class="style9">World Breaker</span></a><br>
      </div>
    </body>
    </html> 
    Last edited by james438; 12-13-2007 at 01:55 AM.

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,718
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    I fixed it. I added
    Code:
    a.style9 {
    color:          #9900CC;
    visited:        #9900CC;
    }
    as opposed to
    Code:
    style9 {
    color:          #9900CC;
    visited:        #9900CC;
    }

  3. #3
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by james438 View Post
    I fixed it. I added
    Code:
    a.style9 {
    color:          #9900CC;
    visited:        #9900CC;
    }
    }
    I have never seen that work, and I dont believe it should on standards compliant browsers. You would need to declare each psuedo selector explicitly, however you can group them together somewhat like.

    Code:
    a.style9:link, a.style9:visited {
         color: #9900cc;
    }

  4. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,718
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    I see the error now. I am now going to use:

    Code:
    a.style9:link {color: #9900cc;}
    a.style9:visited {color: #9900cc;}
    Last edited by james438; 12-13-2007 at 01:35 PM.

  5. #5
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by james438 View Post
    Code:
    a.style9:link {color: #9900cc;}
    a.style9:visited {color: #9900cc;}
    thats correct, the way you have it there does them separately, however you were declaring yours in 1 instance, so thats why I modeled mine the way I did. But if the person is going to have them the same initially, it's usually a good bet they will always want it that way.

  6. #6
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,718
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Thanks for the tip. It all looked like it was working at first glance, but after a closer look I saw that my "fixed" code still was not working quite right.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •