The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Selecting the Parent for Child:hover

Hey there.

Kinda stuck, looking for a bit of help. I'm trying to create a menu where hovering on an element produces a vertical border to the right. However, I can't figure out what the correct syntax would be to select the parent when the child is hovered.

I'm afraid there is no syntax to select a parent. You'd have to use scripting to achieve the effect you want, which is probably a good thing anyway so you can support IE. Something like this would work:

Quite possibly my biggest gripe about CSS. I couldn't even begin to name all of the possibilities such functionality would enable.

As for the question at hand, there is a CSS based solution. It doesn't work in Internet Explorer (of course), but it does show up properly in Opera and Mozilla, and probably other browsers as well. Here is a sample document that I whipped up to illustrate the effect that you're wanting to achieve...

Just from looking at that though, it looks like the side border would remain constant no matter which LI is being hovered mover. What I'm looking for is to switch colors for each list item. So scripting it is. I agree on the gripes with CSS though. More flexibility isn't going to hurt.