NAVIGATION

Hamburger menu


The hamburger menu is a responsive pattern that displays a horizontal navigation menu for pages related to webpage. This navigation menu is required on all top-level pages and must use the primary palette colour.

@700px Resolution:

Logo Here
HTML AND CSS Code

HTML CODE

          
            <div class="containerhamburger">
                <section class="top-nav-hamburger">
                  <div class="logohamburger">
                    <a class = "list1" href="#">Logo Here</a>
                  </div>
                  <input id="menu-toggle-hamburger" type="checkbox" />
                  <label class='menu-button-container-hamburger' for="menu-toggle-hamburger">
                  <div class='menu-button-hamburger'></div>
                </label>
                  <ul class="menu-hamburger">
                    <li><a class = "list1" href="#">Link1</a></li>
                    <li><a class = "list1" href="#">Link2</a></li>
                    <li><a class = "list1" href="#">Link3</a></li>
                    <li><a class = "list1" href="#">Link4</a></li>
                    <li><a class = "list1" href="#">Link5</a></li>
                  </ul>
                </section>  
            </div>
            
        

CSS CODE

        
            body{
                margin:0;
              }
              .containerhamburger {
                box-sizing: border-box;
              }
              
              .top-nav-hamburger {
                display: flex;
                flex-direction: row;
                align-items: center;
                justify-content: space-between;
                background-color: black;
                background:radial-gradient(white,#69cff9);
                color: black;
                height: 50px;
                padding: 1em;
              }
              
              .menu-hamburger {
                display: flex;
                flex-direction: row;
                list-style-type: none;
                margin: 0;
                padding: 0;
              }
              
              .menu-hamburger > li {
                margin: 0 1rem;
                overflow: hidden;
              }
              
              .menu-button-container-hamburger {
                display: none;
                height: 100%;
                width: 30px;
                cursor: pointer;
                flex-direction: column;
                justify-content: center;
                align-items: center;
              }
              
              #menu-toggle-hamburger {
                display: none;
              }
              
              .menu-button-hamburger,
              .menu-button-hamburger::before,
              .menu-button-hamburger::after {
                display: block;
                background-color: black;
                position: absolute;
                height: 4px;
                width: 30px;
                transition: transform 400ms cubic-bezier(0.23, 1, 0.32, 1);
                border-radius: 2px;
              }
              
              .menu-button-hamburger::before {
                content: '';
                margin-top: -8px;
              }
              
              .menu-button-hamburger::after {
                content: '';
                margin-top: 8px;
              }
              
              #menu-toggle-hamburger:checked + .menu-button-container-hamburger .menu-button-hamburger::before {
                margin-top: 0px;
                transform: rotate(405deg);
              }
              
              #menu-toggle-hamburger:checked + .menu-button-container-hamburger .menu-button-hamburger {
                background: rgba(255, 255, 255, 0);
              }
              
              #menu-toggle-hamburger:checked + .menu-button-container-hamburger .menu-button-hamburger::after {
                margin-top: 0px;
                transform: rotate(-405deg);
              }
              @media (max-width: 700px) {
                .menu-button-container-hamburger {
                  display: flex;
                }
                .menu-hamburger {
                  position: absolute;
                  top: 21rem;
                  margin-top: 50px;
                  left: 0;
                  flex-direction: column;
                  width: 100%;
                  justify-content: center;
                  align-items: center;
                }
                #menu-toggle-hamburger ~ .menu-hamburger li {
                  height: 0;
                  margin: 0;
                  padding: 0;
                  border: 0;
                  transition: height 400ms cubic-bezier(0.23, 1, 0.32, 1);
                }
                #menu-toggle-hamburger:checked ~ .menu-hamburger li {
                  border: 1px solid #cbe948;
                  height: 2.5em;
                  padding: 0.5em;
                  transition: height 400ms cubic-bezier(0.23, 1, 0.32, 1);
                }
                .menu-hamburger > li {
                  display: flex;
                  justify-content: center;
                  margin: 0;
                  padding: 0.5em 0;
                  width: 100%;
                  color: black;
                  background:radial-gradient(white,#96c789);
                }
                .menu-hamburger > li:not(:last-child) {
                  border-bottom: 1px solid #444;
                }
              }
              .logohamburger{
                visibility: hidden;
              }
              .containerhamburger2{
                margin-top:1rem;
              }
              .containerResolution{
                margin: 2rem;
              }