CSS to change menu image for current state


I had a request from my customer to make the current page highlight in the navigation when that page is current. I obviously need to create a “current” state image that is slightly different, but not quite sure of the CSS I need to implement to make it ‘swap’ images when active.


Thanks ahead of time!

Hello noslenwerd.

I would very much consider using a sprite technique for this, rather than chopping up your images and making more server requests.


In that way you can have rollovers and the active state.

Thanks sdt. I will take a look at the link now.

sdt… I’m not sure I understand how to implement this correctly? Looks like there are a bunch of different examples on the page, but it does not explain how to integrate this into navigation?

If your images are already chopped up then just keep it that way it’s easier for you. Th following link is all the info you need. Just change the current state CSS with your new image. http://www.visibilityinherit.com/code/current-page.php

Here is another method, if any of those don’t work. You can do this in under a day. This is more of a step by step. It’s better to use sprites for the reasons explained there.