Bac0
Bac0

Reputation: 51

CSS Drop down menu Hover

I need a help. I was doing a drop up menu with share icons. My problem is this: I'd like that when I pass the mouse over the main-share icon in the footer and than go to select another icon (like facebook), the main icon remains selected like as mouse hover, but it don’t works.

<div class="footer large blue">Footer Blue
<div class="pull-right buttons">
    <ul>
        <li><a class="btn2 large share2 blue" href="#">Share</a>

            <ul>
                <li><a class="btn large rss" href="#">RSS</a>

                </li>
                <li><a class="btn large twitter" href="#">Twitter</a>

                </li>
                <li><a class="btn large plus" href="#">G+</a>

                </li>
                <li><a class="btn large facebook" href="#">Fb</a>

                </li>
            </ul>
        </li>
        <li><a class="btn2 large btt blue" href="#">Back to Top</a>

        </li>
    </ul>
</div>

I think the problem is that the elements li and a, are two independent tags.

Watch this image to understand it better what am i saying (because i’m not able to explain it better ._.)

http://db.tt/Kujz3Pv4

Here's the code: http://jsfiddle.net/zPavan/KHWJ4/2/

If there are any problems or have suggestions on the code, I thank you for the advice!

Upvotes: 3

Views: 307

Answers (2)

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114437

I think this will do it:

.buttons ul li:hover > a {
    background-color: #1f5f79;
} 

Upvotes: 0

Explosion Pills
Explosion Pills

Reputation: 191819

Instead of depending on the hovering of the <a> specifically, make it depend on the list item that contains the entire <ul>:

li:hover > .btn2.blue {
    background-color: hsl(197, 59%, 30%);
}

I would suggest giving that specific li a class like .share that you can use as well.

http://jsfiddle.net/ExplosionPIlls/KHWJ4/3/

Upvotes: 4

Related Questions