Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   Hovering over links in sidebar - I want WHOLE background to change, not just text. (http://forum.bytesforall.com/showthread.php?t=9311)

in10 Aug 31, 2010 03:52 PM

Hovering over links in sidebar - I want WHOLE background to change, not just text.
 
I'm trying to make it so that when you hover over a link in a sidebar widget, it changes the background of the entire <li> area where that link is as opposed to just the text of that link.

For example, I'm trying to do what they did in the right sidebar ("popular articles") here: http://www.copyblogger.com/

The whole area around the text is highlighted when you hover over a link. In my case, just the text itself is being highlighted when it's hovered over.

How do I make that happen?

I'm currently (and unsuccessfully) doing this:

#right ul li a:hover {
background: #f0f0f0;
}

lmilesw Aug 31, 2010 03:56 PM

Could you post a link to your site?

lmilesw Aug 31, 2010 09:13 PM

Try this instead.
HTML Code:

#right ul li:hover {
background: #f0f0f0;
}


in10 Sep 1, 2010 05:37 AM

Perfect, thanks!

in10 Sep 1, 2010 07:04 AM

Actually, one other follow up question if you have another second.

What you recommended made it so that the whole area's background changes when you hover over it. How would I make it so that the whole area is also clickable as part of the link?

Thanks again.

lmilesw Sep 1, 2010 08:55 AM

I fiddled with this for a bit stumbled on to a solution. Try taking out the li so the code looks like below. Be sure and have a space after ul.
HTML Code:

#right ul :hover {
background: #f0f0f0;
}


in10 Sep 1, 2010 10:33 AM

Hmmm, it doesn't seem to work for me.

It just changes the background of the entire list and all of the items on it when any of the links are hovered over (as opposed to just the link that's being hovered over), and it still doesn't make the whole area clickable.

I'll leave it live on my site for a bit if you want to see what I mean.

Again, I appreciate the help big time.

lmilesw Sep 1, 2010 11:09 AM

You have to put a space between ul and :hover. you have ul:hover and it needs to be
HTML Code:

ul :hover

in10 Sep 1, 2010 12:30 PM

Ah, I see what you're saying. The problem however is that I've put it like it should be:

#right ul :hover {
background: #f0f0f0;
}

with the space there in the css inserts box. For some reason, it's getting rid of that space on its own.

lmilesw Sep 1, 2010 01:42 PM

I kinda wondered if it would work. I guess the best solution is the first.

in10 Sep 1, 2010 02:30 PM

I hear ya. Thanks again for the help.


All times are GMT -6. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.