Wed Sep 21 2022

Menu Bar with Text Filling Effect

CSS3032 views

File Name: menubar-filling-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>Menubar with Filling 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=Oswald:wght@500&display=swap" rel="stylesheet"> 
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: 'Oswald', sans-serif;
        }

        body {
            background-color: #292929;
        }

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

        nav {
            background-color: #fff;
            padding: 10px 30px;
            border-radius: 8px;
            display: flex;
            justify-content: center;
            gap: 50px;
            box-shadow: 0 3px 5px 0 rgba(0,0,0,0.6),
                        inset 0 -3px 8px 0 rgba(0,0,0,0.3);
        }

        nav a {
            text-decoration: none;
            text-transform: uppercase;
            font-size: 20px;
            font-weight: 500;
            letter-spacing: 2px;
            color: #8f8f8f;
            position: relative;
        }

        nav a::before {
            position: absolute;
            content: attr(data-item);
            color: #e44134;
            top: 0;
            left: 0;
            bottom: 0;
            width: 0;
            overflow: hidden;
            transition: 0.5s all ease-in-out;
        }

        nav a:hover::before {
            width: 100%;
        }
    </style>
</head>
<body>
    <section>
        <nav>
            <a href="" data-item="Home">Home</a>
            <a href="" data-item="Projects">Projects</a>
            <a href="" data-item="Services">Services</a>
            <a href="" data-item="Blog">Blog</a>
            <a href="" data-item="Contact">Contact</a>
        </nav>
    </section>
</body>
</html>

Result Screenshot(s)

Menu Bar with Text Filling 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.