Page Widget How to - Fly down menu with animation








Question

We would like to know how to fly down menu with animation.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#menu {<!--  ww  w .  j  a va2s . co  m-->
  margin-top: -300px;
  transition: margin-top 1s ease;
}

#menu:target {
  margin-top: 0px;
}
</style>
</head>
<body>
  <a href="#menu">Menu</a>
  <div id="menu">
    <a href="#">Close Menu</a>
    <ul>
      <li>first</li>
      <li>second</li>
      <li>third</li>
      <li>fourth</li>
    </ul>
  </div>
</body>
</html>

The code above is rendered as follows: