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 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hightlighted Links

    I need the code for a link to be highlighted when you are viewing it.

    For example:
    If on a webpage i have 4 links 1, 2, 3, 4

    and i'm viewing link 3 that link 3 is highlighted so i know i'm viewing that link.

  • #2
    Regular Coder
    Join Date
    May 2004
    Location
    Berkeley, California Age: 15
    Posts
    398
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well the simplest way to do this without server-side coding is:

    applying a unique id to the body tag of each page. Then using that to apply rules only if you're on that page. This'll make more sense once you see the code:

    Code:
    ***Page 1***
    
    <body id="page2">
    ...
    <a href="#" id="page2link">
    <a href="#" id="page3link">
    
    ...
    </body>
    
    *** Page 3***
    
    <body id="page3">
    ...
    <a href="#" id="page2link">
    <a href="#" id="page3link">
    ...
    </body>
    and CSS:

    Code:
    #page2 #page2link, #page3 #page3link {
    background: #fc3;
    }
    That will highlight #page2link only if you're on page 2, same goes with page 3. Comprende?
    Jalenack.com .:. YWDA Founder .:. Rounded Corners Maker 1.1! .:. My Blog
    The hardest thing about teaching is not knowing the right answers, but knowing the right questions - Elisabeth Klein
    Pretty buttons does not a great website make.


  •  

    Posting Permissions

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