Results 1 to 8 of 8

Thread: link color not working correctly...

  1. #1
    Join Date
    Feb 2008
    Location
    Not telling! (sorry...)
    Posts
    48
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default link color not working correctly...

    I've got the links set up to where they are red and visited links are purple. (#9900FF) Whenever I preview the page, one link shows up red and the rest blue. And they don't change after being visited. I am using a different browser than I normally do- would that affect it or does it matter?

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Can you post some code? You're probably just declaring it on one instance.


    If you want to make the change site wide (instead of just some select links), add the following to your header (or external CSS file).

    Code:
    <style>
        a:link, a:active  { color:red; }
        a:visited           { color:#9900FF; }
        a:hover             { color:green;}
    </style>

  3. The Following User Says Thank You to Medyman For This Useful Post:

    Twilightrose917 (03-06-2008)

  4. #3
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    ...but not for compliant browsers like FF.
    See this code:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <style type="text/css">
    #nav a {
        color:#f00;
        text-decoration:none; 
     }
    ul
    {
    list-style-type:none;
    font-family:Tahoma;
    font-size:10pt;
    
    }
    </style>
    
    <script type="text/javascript">
    window.onload=function() 
    {
       var accept=document.getElementById('nav').getElementsByTagName('a');
    for(var start=0;start<accept.length;start++)
    {
       accept[start].onclick=function() 
       {
    	for(var start=0;start<accept.length;start++) 
    	{
    	accept[start].style.textDecoration='none';
    		{
    		this.style.textDecoration='underline';
    		this.style.color='#9900FF';
    		}
        }
       }
      }
     }
    </script>
    
    </head>
    <body>
    
    <ul id="nav">
    <li><a href="#">navigation one</a></li>
    <li><a href="#">navigation two</a></li>
    <li><a href="#">navigation three</a></li>
    <li><a href="#">navigation four</a></li>
    <li><a href="#">navigation five</a></li>
    </ul>
    
    </body>
    </html>
    See if it helps
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  5. The Following User Says Thank You to rangana For This Useful Post:

    Twilightrose917 (03-06-2008)

  6. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by rangana View Post
    ...but not for compliant browsers like FF.
    What? Since when are anchor pseudo classes not stanards compliant?

  7. #5
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Quote Originally Posted by Medyman View Post
    What? Since when are anchor pseudo classes not stanards compliant?
    No, that's not what I mean. I mean that the effects may be well on IE, but not in FF..and maybe in Opera.

    I only have FF here to test, but I observed that the active link does'nt work.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  8. #6
    Join Date
    Feb 2008
    Location
    Not telling! (sorry...)
    Posts
    48
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default

    I'll try both of them and see which one works better. I'm supposed to put those codes in the <head> section, right? (just checking... idk for sure...)

    and thanks for the help.

  9. #7
    Join Date
    Feb 2008
    Location
    Not telling! (sorry...)
    Posts
    48
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default

    I got it to work in IE... and FF... and Safari... but for a random question - why do some things work in some browsers but not in others???

  10. #8
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by rangana View Post
    I only have FF here to test, but I observed that the active link does'nt work.
    ummm...it 100% works. maybe you did something wrong in your testing.

    Quote Originally Posted by Twilightrose917 View Post
    I got it to work in IE... and FF... and Safari... but for a random question - why do some things work in some browsers but not in others???
    To make web coding more exciting. Things COULD work just as you want them to but what's the fun in that.

    Or maybe it's because MS choose not to follow web standards. They're coming around though...some stuff was fixed in IE7 and IE8 is looking pretty promising. Of course, this means that the websites we've created for the old browsers with hacks to make IE comply will break....how ironic!

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
  •