2

I created the drop-down menu by using CSS and HTML. I just can't figure out what am I making wrong. When I hover the mouse over the Social it doesn’t pop-up me the drop-down menu.

Entire fiddle here

Js Fidle Example

A part of code where I think its mistake.

   #nav ul li a:hover {
    color: #ccc;
    text-decoration: none;
}
#nav ul li:hover ul{
    display : block; 
}
#nav ul ul {
    display: none;
    position : absolute ;
    background-color: #333;
    border: 5px solid #222;
    border-top : 0;
    margin-left: -5px;        
}

3 Answers 3

1

youo have <li><a href="#"> Social</a></li> and it should be

<li><a href="#"> Social</a>
                <ul>
                  <li> Facebook</li>
                  <li> Twitter </li>
                  <li> Youtube </li>
                </ul>
             </li>

JSFIDDLE

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot i spend 20 minutes of searching problem in CSS.
1

You need to put the sub UL inside the li

<li><a href="#"> Social</a>
    <ul>
         <li> Facebook</li>
         <li> Twitter </li>
         <li> Youtube </li>
    </ul>
</li>

See fidde: http://jsfiddle.net/2j55uthz/1/

The reason is because in your CSS this line:

#nav ul li:hover ul {
    display: block
}

Is target the UL element inside of the hovered li

Comments

1

The <ul> containing facebook, youtube, twitter needs to be within the social <li>. It works with that change.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.