Thu Jul 07 2022

Underline Effect on Menu

CSS5195 views

File Name: underline-menu-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>Underline Effect on Menu</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=Montserrat:wght@400;500&display=swap" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: 'Montserrat', sans-serif;
        }

        body {
            background-color: #383838;
        }

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

        ul {
            display: flex;
            list-style: none;
        }

        ul li {
            margin: 0 20px;
            position: relative;
        }

        ul li::before {
            content: '';
            position: absolute;
            width: 0;
            height: 2px;
            background-color: #fff;
            left: 50%;
            bottom: -10px;
            transition: 0.3s all ease-in-out;
        }

        ul li:hover::before {
            width: 100%;
            left: 0;
        }

        ul li a {
            text-decoration: none;
            color: #fff;
            font-weight: 500;
            font-size: 18px;
        }
    </style>
</head>
<body>
    <section>
        <ul>
            <li><a 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>
    </section>
</body>
</html>

Result Screenshot(s)

Underline Effect on 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.