I'm a little bit lost on how to animate my dropdown menu with CSS only. Can you guys light me up here?
I've tried
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
but I can't hit the note where how to exactly do it. The sub-menu shows up but instantly without any transitions. Any help will be great.
.dropbtn {
background-color: inherit;
color: inherit;
padding: inherit;
font-size: inherit;
}
.dropdown {
position: relative;
display: inline-block;
font-size: inherit;
}
.dropdown-content {
display: none;
position: absolute;
background-color: white;
min-width: 150px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
height: 100px;
}
.dropdown-content a {
color: black;
padding: 12px 12px;
text-decoration: none;
display: block;
background-color: white;
}
.dropdown:hover .dropdown-content {
display: block;
height: 200px;
}
<ul>
<li class="dropdown">
<a href="javascript:" class="dropbtn">Dropdown</a>
<div class="dropdown-content">
<a href="#">Menu 1</a>
<a href="#">Menu 2</a>
<a href="#">Menu 3</a>
</div>
</li>
</ul>