Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS active / current menu

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24235
    seba
    Member

    Does anyone know how I can add an active status to a menu, I’ve put …
    css…
    #menu li a:hover {
    color: #B5D5FF;
    background: #FFF;
    font-family:arial;
    }

    #menu li a:active {
    color:#AB5667;
    font-family:arial;
    }

    #menu li a:visited {
    color:#FBC8B4;
    background-color : #fff

    html…
    <div id="menu">
    <ul>
    <li></li>
    <li><a href="gettingready.htm" target="_self">Getting ready </a></li>
    <li><a href="gettingready2.htm" target="_self">2 </a></li>
    <li><a href="happycouple.htm" target="_self">The happy couple </a></li>
    <li><a href="happycouple2.htm" target="_self">2 </a></li>
    <li id="active"><a href="ceremony.htm" target="_self" id="current">Ceremony</a></li>
    <li><a href="ceremony2.htm" target="_self">2 </a></li>
    <li><a href="celebrations.htm" target="_self">Celebrations <span></span> </a></li>
    <li><a href="celebrations2.htm" target="_self">2 </a></li>
    </ul>
    </div>

    The hover and visited both work fine but the active doesn’t work, only when I hold down on the link, any ideas anyone?
    Cheers.

    #54344
    Chris Coyier
    Keymaster

    a:active (with a colon) is a pseudo-selector that indicates the link is currently being clicked on or has been "tabbed" to. In your code, your link item has a ID of current, so use that:

    Code:
    #menu li a#current {
    color:#AB5667;
    font-family:arial;
    }
    #54347
    seba
    Member

    Yeah I just figured it out, cheers!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.