Thu Sep 08 2022

Animated Login Form

CSS3544 views

File Name: animated-login-form.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>Animated Login Form</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=Nunito&display=swap" rel="stylesheet"> 
    <style>
        * {
            margin: 0;
            padding: 0;
            outline: 0;
            font-family: 'Nunito', sans-serif;
        }

        section {
            background-color: #1abc9c;
            position: relative;
            width: 100%;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        ul#bgAnimation {
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            z-index: 0;
            overflow: hidden;
        }

        ul#bgAnimation li {
            position: absolute;
            display: block;
            list-style: none;
            width: 40px;
            height: 40px;
            background-color: rgba(255,255,255,0.4);
            bottom: -200px;
            animation: bgAni 25s infinite linear;
        }

        ul#bgAnimation li:nth-child(1) {
            width: 20px;
            height: 20px;
            left: 95%;
            animation-delay: 10s;
        }

        ul#bgAnimation li:nth-child(2) {
            width: 80px;
            height: 80px;
            left: 25%;
            animation-delay: 0s;
        }

        ul#bgAnimation li:nth-child(3) {
            width: 70px;
            height: 70px;
            left: 75%;
            animation-delay: 18s;
        }

        ul#bgAnimation li:nth-child(4) {
            width: 30px;
            height: 30px;
            left: 10%;
            animation-delay: 5s;
        }

        ul#bgAnimation li:nth-child(5) {
            width: 40px;
            height: 40px;
            left: 84%;
            animation-delay: 1s;
        }

        ul#bgAnimation li:nth-child(6) {
            width: 50px;
            height: 50px;
            left: 50%;
            animation-delay: 15s;
        }

        ul#bgAnimation li:nth-child(7) {
            width: 100px;
            height: 100px;
            left: 40%;
            animation-delay: 6s;
        }

        ul#bgAnimation li:nth-child(8) {
            width: 60px;
            height: 60px;
            left: 85%;
            animation-delay: 17s;
        }

        @keyframes bgAni {
            from {
                transform: translateY(0) rotate(0deg);
                opacity: 1;
                border-radius: 0;
            }

            to {
                transform: translateY(-1000px) rotate(720deg);
                opacity: 0;
                border-radius: 80%;
            }
        }

        form {
            width: 350px;
            position: relative;
            z-index: 10;
            text-align: center;
        }

        input[type=text],
        input[type=password] {
            padding: 10px 10px;
            border: solid 1px #fff;
            margin: 10px 0;
            width: calc(90% - 22px);
            text-align: center;
            font-size: 16px;
            background-color: rgba(255,255,255,0.2);
            border-radius: 2px;
            color: #292929;
            transition: 0.3s all ease-in-out;
        }

        input[type=text]::placeholder,
        input[type=password]::placeholder {
            color: #fff;
            transition: 0.3s all ease-in-out;
        }

        input[type=text]:focus::placeholder,
        input[type=password]:focus::placeholder {
            color: #393939;
        }

        input[type=text]:focus,
        input[type=password]:focus,
        input[type=text]:not(:placeholder-shown),
        input[type=password]:not(:placeholder-shown) {
            width: calc(100% - 22px);
            background-color: rgba(255,255,255,0.9);
        }

        button[type=submit] {
            width: 90%;
            border:none;
            font-size: 16px;
            border-radius: 2px;
            color: #292929;
            cursor: pointer;
            padding: 10px 0;
            transition: 0.3s all ease-in-out;
            margin-top: 10px;
        }

        button[type=submit]:hover {
            width: 100%;
        }
    </style>
</head>
<body>
    <section>
        <ul id="bgAnimation">
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>

        <form action="">
            <input type="text" placeholder="Username" />
            <input type="password" placeholder="Password" />
            <button type="submit">Login</button>
        </form>
    </section>
</body>
</html>

Result Screenshot(s)

Animated Login FormWorking 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.