Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Link Color Help

  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    40
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Link Color Help

    I got a menu list which is grey, and when you hover over it is green. I need it to stay green on whichever link is clicked. I tried changing color of a:selected and a:active but it didn't work. Thank you in advance

    Code:
    <ul id="menu-list"> 
    	  <li><a href="" style="text-decoration: none">News</a></li> 
    	  <li><a href="" style="text-decoration: none">About Us</a></li> 
    	  <li><a href="" style="text-decoration: none">Gallery</a></li> 
    	  <li><a href="" style="text-decoration: none">Affiliates</a></li> 
    	  <li><a href="" style="text-decoration: none">Biography</a></li> 
          <li><a href="" style="text-decoration: none">Contact</a></li>
    	</ul>
    Code:
    #menu-list {
    	padding:0; 
    	margin:0;
    	 
    }
    #menu-list li { 
    	list-style-type:none;
    	margin-bottom: 7px;
    }
    
    #menu-list a:link, #menu-list a:visited, #menu-list a:active{
    	color: #5e5e5e;
    }
    
    #menu-list a:hover, #menu-list a.active, #menu-list a.selected{
    	color: #07CB25;
    }

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,668
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello kamaro,
    There's no such thing as a:selected. Your CSS has an a.selected which would style an anchor with a class="selected", that might work for you. You would need to goto each page and put the class on the correct anchor for that to work.

    Here is another method - http://nopeople.com/CSS%20tips/h_ul_...ges/index.html
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New Coder
    Join Date
    Jan 2012
    Location
    Seattle, WA
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can give it this effect by making it green on a:visited, but the link will not change back when another link is clicked.

    There is no CSS property for this.

    I would recommend looking into Javascript.


  •  

    Posting Permissions

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