Thu Nov 03 2022

Hamburger Menu

CSS1031 views

File Name: hamburger-menu.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Menu Button</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            background-color: #292929;
        }

        section {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100vh;
        }

        a {
            width: 100px;
            height: 100px;
            background-color: #fff;
            border-radius: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-flow: column;
            overflow: hidden;
            transition: 0.3s all ease 0.1s;
        }

        a span {
            width: 60%;
            height: 3px;
            background-color: #292929;
            border-radius: 8px;
            transform-origin: left;
        }

        a span:first-child {
            transform: translate(0%, -250%);
            transition: 0.3s all ease 0.3s;
        }

        a span:nth-child(2) {
            transition: 0.3s all ease 0.3s;
        }

        a span:last-child {
            transform: translate(0%, 250%);
            transition: 0.3s all ease 0.3s;
        }

        a:hover {
            transform: rotate(-90deg);
            transition: 0.3s all ease 0.4s;

        }

        a:hover span:first-child {
            width: 30%;
            transform: translate(0%, 100%) rotate(-50deg);
            transition: 0.3s all ease 0s;
        }

        a:hover span:nth-child(2) {
            transform: translateX(-300%);
            transition: 0.3s all ease 0s;
        }

        a:hover span:last-child {
            width: 30%;
            transform: translate(0%, -100%) rotate(50deg);
            transition: 0.3s all ease 0s;
        }
    </style>
</head>
<body>
    <section>
        <a href="">
            <span></span>
            <span></span>
            <span></span>
        </a>
    </section>
</body>
</html>

Result Screenshot(s)

Hamburger MenuWorking Sample0

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.