Active menu items

Discussion in 'CSS' started by mnymkr, May 18, 2006.

  1. #1
    I am trying to get my menu item to stay active when i am on a certain pages of my site but still have the hover effect when looking at other menu items.

    i have the a:active set but it doesnt do anything.....for instance all my menu items are red....when i am on services page i want all to be red but services which will be grey...

    is this possible
     
    mnymkr, May 18, 2006 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    :active refers to an active state, i.e. when the [enter] key is hit or a mouse button is down.

    Make a ruleset for, let's say, #this-page, then on each page, give the menu link to that page the id, this-page.
    
    #this-page a {
       blah blah blah
       }
    
    #this-page a:hover {
       blah blah blah
       }
    =======
    <ul>
      <li><a href="">home</a></li>
      <li id="this-page"><a href="">about</a></li>
      <li><a href="">contact</a></li>
    </ul>
    Code (markup):
    cheers,

    gary
     
    kk5st, May 18, 2006 IP