The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

nav background color after click

  • # September 15, 2012 at 9:49 pm

    I created a hover effect for my nav links. I want the hover background color to stay after the user has clicked a particular nav link, so it will show them the site area they are in. This site does that, as do a number of others. How is it done?

    Thanks for any help!


    # September 15, 2012 at 10:14 pm

    This reply has been reported for inappropriate content.

    A couple ways to do this…

    A. Add a class to the current page item, e.g. “active”…You just simply move it to the respective page item on each separate html page

    B. Use Jquery to add/remove the “active” class as needed when the items are clicked.

    # September 15, 2012 at 11:47 pm

    Also, if you’re using WordPress you can just target the body class/ID to set the active class.

    ` .active {color: red;}`

    # November 24, 2012 at 3:21 pm

    Thank you both :-)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed