View Full Version : CSS Hover Menu - How to keep one button highlighted?

10-28-2007, 11:16 PM
I implemented a horizontal menu from listamatic, but I want to keep one of the options highlighted when you are on that specific page. So for instance, when you click on about us, the rest of the options are still white background, but the about us, would be no longer clickable, and the orange background would show.


I've been looking around, but haven't been able to find how to do this?

10-29-2007, 12:00 AM
Set a class for that one link, i(e: current) and style it to make the on:hover condition the same as the link state. The link state for the class would be the same as the hover which happened originally. Follow that?

Also, remove the <a></a> from that item so it can't be clicked.

10-29-2007, 01:30 AM
so would I have something like this:

<li id="active"><p class="current">About Us</p></li>

and then in my stylesheet have:

p.current {
same stuff as the hover li?

Like that?

10-29-2007, 01:47 AM
should be good.

If that gives you trouble add #active in front of it, perhaps.

10-29-2007, 02:10 AM
Ok I got it to stay highlighted,


But when you rollover the item next to it, the background color doesn't connect with the highlighted one. I messed with the padding, and margin, but couldn't get them to connect without that white space. Any ideas?

10-29-2007, 02:19 AM
It looks more like a "tab" with the white space there. I would leave it in for that reason. I have a site where they join-up and I want to alter it to what you have, so I vote leave it there.

(I can't find the fix, either...)


10-29-2007, 02:20 AM
Ok, I'll just leave it for now....

Thanks for your help. Oh, do you have any CSS books that you would recommend for a handy reference?

10-29-2007, 02:24 AM
There is a gal from Austin , Tx, (I think), that wrote a pretty fair book.

Virginia DeBolt, Integrated HTML and CSS, Sybex Publishing.

She teaches at a College down there someplace.


Wrong State... another thread had a Texas page on it, sorry, you Americans all look the same :D