html - Dropdown Menu Smooth Transition & Sizing Issue -
so have 3 issues dropdown menu have in navbar site working on.
i dropdown appear in more smooth fashion, when add webkit-transitions
classes in css, effect not take place.
my other issue dropdown items smaller parent; want dropdown items match width of .dropdown
class item.
finally, when adjust menu mobile devices, dropdown
class still displays blank space. surely there way make blank space disappear well.
.navbar { border-radius: 25px; list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #66cc66; text-align: center; } .navbar li { display: inline-block; } .navbar li { display: block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; transition: 0.2s; z-index: 1; } .navbar li a:hover { -webkit-transition-duration: 0.4s; transition-duration: 0.4s; background-color: #339966; } .dropdown { position: relative; text-align: center; } .dropdown-content { display: none; position: absolute; background-color: #66cc66; padding: 0; margin: 0; z-index: 1; text-align: center; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15); } .dropdown-content { display: block; text-align: center; } .dropdown-content li { display: block; text-align: center; padding: 0px; margin: 0px; } .dropdown-content:hover { display: block; } .dropdown:focus+.dropdown-content { display: block; position: absolute; } .dropdown:hover+.dropdown-content { display: block; position: absolute; cursor: pointer; } ul.navbar li.icon { display: none; } @media screen , (max-width:600px) { .logo img { max-width: 100%; } ul.navbar li { display: none; } ul.navbar li.icon { text-align: center; display: block; } .contact { text-align: center; display: block; } .contact input { min-width: 100%; } } @media screen , (max-width: 600px) { ul.navbar.responsive li { position: relative; } ul.navbar.responsive li .icon { position: absolute; } ul.navbar.responsive li { float: none; display: block; text-align: center; } .dropdown { display: none; visibility: hidden; } .dropdown-content { float: none; display: block; text-align: center; position: relative; box-shadow: none; } }
<div class="navpad"> <ul class="navbar" id="javamenu"> <li><a href="index.html">home</a></li> <li><a href="about.html">about</a></li> <li> <a href="" class="dropdown">products ▾</a> <ul class="dropdown-content"> <li><a href="#.html">drop 1</a></li> <li><a href="#.html">drop 2</a></li> </ul> </li> <li><a href="contact.html">contact</a></li> <li class="icon"> <a href="javascript:void(0);" onclick="mobilefunction()">☰</a> </li> </ul> </div>
the webkit transition trying add dropdown menu.
-webkit-transition: .25s ease; -moz-transition: .25s ease; -ms-transition: .25s ease; -o-transition: .25s ease; transition: .25s ease;
wiki
Comments
Post a Comment