Adding CSS transition on Bootstrap drop-down menu

Adding CSS transition on Bootstrap drop-down menu

If you implemented bootstrap into your WordPress template and want to add CSS transitions to drop-down menu, you can use the following code:

@media (min-width: 768px) {
.dropdown .dropdown-menu{
    display: block; 
  opacity:0;
-webkit-transition: all 200ms ease-in;
-moz-transition: all 200ms ease-in;
-ms-transition: all 200ms ease-in;
-o-transition: all 200ms ease-in;
transition: all 200ms ease-in;
}
.dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
}
}

Why media queries? Because you don’t want display:block on hover on the mobile menu (as the hover used for this would double the submenu). As for CSS transitions, you can generate them using any of the online generators, such as this one.