Sat Aug 13 2022

Menu Filling Up Effect

CSS4222 views

File Name: menu-fillingup-effect.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 with FillUp Hover Effect</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet"> 
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: 'Poppins', sans-serif;
        }
        
        body {
            background-color: #292929;
        }

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

        ul {
            display: flex;
            list-style: none;
            gap: 15px;
        }

        ul li a {
            text-decoration: none;
            color: #fff;
            font-size: 30px;
            position: relative;
            transition: 0.8s all linear;
            padding: 5px 15px;
        }
        
        ul li a:hover {
            color: #292929;
        }

        ul li a::before {
            position: absolute;
            content: '';
            bottom: 0;
            left: 50%;
            width: 0;
            height: 0;
            background-color: #ff0;
            z-index: -1;
        }

        ul li a:hover::before {
            animation: ani 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
        }

        @keyframes ani {
            0% {
                width: 0%;
                height: 1px;
                left: 50%;
            }

            50% {
                width: 100%;
                height: 1px;
                left: 0;
            }

            100% {
                width: 100%;
                height: 100%;
                left: 0;
            }
        }
        
    </style>
</head>
<body>
    <section>
        <nav>
            <ul>
                <li><a class="active" href="">Home</a></li>
                <li><a href="">About Us</a></li>
                <li><a href="">Services</a></li>
                <li><a href="">Contact Us</a></li>
            </ul>
        </nav>
    </section>
</body>
</html>

Result Screenshot(s)

Menu Filling Up EffectWorking 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.