0

ul li ul.dropdown{
	min-width: 125px;
    background: #f2f2f2;
    display: none;
    position: absolute;
    z-index: 999;
    left: 0;
}
ul li:hover ul.dropdown{
    display: block;
}
ul li ul.dropdown li{
	display: block;
    }
<div class="navigation">
 


	<ul>
	<li><a href = 'index.html'>Home</a></li>
	<li><a href = 'media.html'>Media Design</a></li>
	<li><a href = 'innovatie.html'>Innovatieroutes</a></li>
	<li><a href = 'info.html'>Informatie</a></li>
	        <ul class="dropdown">
            <li><a href="#">Open dagen</a></li>
            <li><a href="#">Beroepen</a></li>
            <li><a href="#">Studie</a></li>
			</ul>
	<li><a href = 'contact.html'>Contact</a></li>
</ul>

I'm trying to make a CSS menu with a dropdown, but somehow I am not able to let to menu drop down when I hover the mouse over the tab "Informatie", the sub menus will just display after "Informatie". Maybe some of you guys are able to help me with my menu.

2 Answers 2

1

Fixed your code

ul li ul.dropdown{
	min-width: 125px;
    background: #f2f2f2;
    display: none;
    position: absolute;
    z-index: 999;
    left: 0;
}
ul li:hover ul.dropdown{
    display: block;
}
ul li ul.dropdown li{
	display: block;
    }
<div class="navigation">
 


	<ul>
	<li><a href = 'index.html'>Home</a></li>
	<li><a href = 'media.html'>Media Design</a></li>
	<li><a href = 'innovatie.html'>Innovatieroutes</a>
	<li><a href = 'info.html'>Informatie</a>
	        <ul class="dropdown">
            <li><a href="#">Open dagen</a></li>
            <li><a href="#">Beroepen</a></li>
            <li><a href="#">Studie</a></li>
			</ul>
     </li>
	<li><a href = 'contact.html'>Contact</a></li>
</ul>

Your mistake was, you wrote the ul outside li's closing tag </li>. You've to put ul's code right after ending of a tag's closing tag </a>

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

4 Comments

Hi Xahed, somehow when I hover over the tab information, my dropdown won't show up.
I see its working fine on my answer. If you hover on Information, you see the submenu
A little explanation would be helpful. What was the problem and how does your answer solve it?
added explanation at the end of answer
1

You need to put the ul inside the li.

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.