Video:
Source Code:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login</title>
</head>
<style>
*{
    margin: 0;
    padding: 0;
    font-family: Century Gothic;
    box-sizing: border-box;
}
body{
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: -webkit-linear-gradient(right, #7579ff, #b224ef);
}
.parent h2{
    color: #ffffff;
    font-weight: 500;
    margin-bottom: 40px;
    padding-bottom: 5px;
    width: 40%;
    border-bottom: 1px solid #ffffff;
}
.main_u{
    padding-bottom: 40px;
}
.user_div{
    height: 50px;
    width: 250px;
    position: relative;
    background: none;
}
.user_div label span{
    position: absolute;
    bottom: 3%;
    left: 0%;
    font-size: 20px;
    font-weight: 500;
    transition: 0.3s ease;
    color: #ffffff;
}
.user_div label input{
    height: 100%;
    width: 100%;
    padding-top: 20px;
    border: none;
    outline: none;
    border-bottom: 1px solid #ffffff;
    font-size: 18px;
    font-weight: 500;
    color: #ffffff;
    /* color: #00a3e8; */
    transition: .3s ease;
    background: none;
}
.user_div label input:focus ~ span,
.user_div label input:valid ~ span
{
    position: absolute;
    bottom: 100%;
    /* color: #00a3e8; */
    font-size: 15px;
}
/* .user_div label input:focus{
   border-bottom: 1px solid #00a3e8;
}
  */
.pass_div{
    height: 50px;
    width: 250px;
    position: relative;
    background: none;
}
.pass_div label span{
    position: absolute;
    bottom: 3%;
    left: 0%;
    font-size: 20px;
    font-weight: 500;
    transition: 0.3s ease;
    color: #ffffff;
}
.pass_div label input{
    height: 100%;
    width: 100%;
    padding-top: 20px;
    border: none;
    outline: none;
    border-bottom: 1px solid #ffffff;
    font-size: 18px;
    font-weight: 500;
    color: #ffffff;
    /* color: #00a3e8; */
    transition: .3s ease;
    background: none;
}
.pass_div label input:focus ~ span,
.pass_div label input:valid ~ span
{
    position: absolute;
    bottom: 100%;
    font-size: 15px;
    /* color: #00a3e8; */
}
/* .pass_div label input:focus{
    border-bottom: 1px solid #00a3e8;
} */
.btn{
    border: 1px solid #ffffff;
    background: none;
    outline: none;
    color: #ffffff;
    width: 50%;
    padding: 7px 10px;
    font-size: 20px;
    margin-top: 40px;
    transition: .3s ease;
    cursor: pointer;
}
.btn:hover{
    background: #ffffff;
    color: black;
}
</style>
<body>
    <div class="parent">
        <h2>Login</h2>
        <div class="main_u">
            <div class="user_div">
                <label for="user">
                    <input type="text" name="user" required>
                    <span>Username..</span>
                </label>
            </div>
        </div>
        <div class="main_p">
            <div class="pass_div">
                <label for="pass">
                    <input type="password" name="pass" required>
                    <span>Password..</span>
                </label>
            </div>
        </div>
        <button class="btn">Login</button>
    </div>
</body>
</html>
Comments
Post a Comment