Toggle Function with CSS

Implemented the toggle functionality using vanilla CSS
mail@pastecode.io avatar
unknown
css
7 months ago
553 B
1
Indexable
Never
 nav .nav-bar {
    width: 480px;
  }
  nav .menu {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80%;
    height: 100%;
    position: fixed;
    top: 0;
    right: -100%;
    z-index: 100;
    background: #010a1b;
  }
  nav .menu li {
    margin: 20px 0;
  }
  nav .menu li a {
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    padding: 10px;
    text-transform: uppercase;
  }
  nav .open-menu,
  nav .menu .close-menu {
    display: block;
  }
  #check:checked ~ .menu {
    right: 0;
  }