Creating a Smooth Sliding Menu

This is a companion discussion topic for the original entry at

After 5 years, this tutorial got a well deserved make over. Mostly minor changes here and there! :stuck_out_tongue:

Look, ma, no JavaScript!

menu {
  position: fixed;
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: -100vw;
  margin: 0;
  background: black;
  transition: left 500ms;
  list-style: none;
menu a {
  font-size: 2rem;
  text-decoration: none;
  color: white;
button:focus + menu {
  left: 0vw;
  <li><a href="#">Home</a></li>
  <li><a href="#">About</a></li>
  <li><a href="#">Contact</a></li>
  <li><a href="#">Search</a></li>

JSFiddle demo

1 Like