Transparent Form Using only HTML and CSS

 HTML CODE

<!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>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="formbox">
        <h1 class="heading">Hello There !</h1>
        <p>Please Login to continue</p>
        <div class="username-box">
            <input class="username" type="text" placeholder="Username">
        </div>

        <div class="password-box">
            <input class= "password"type="password" placeholder="Passoword">
        </div>

        <input class="btn" type="button" value="Login">

    </div>
   
</body>
</html>

CSS CODE

*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

html{
    font-size: 62.5%;
}

body{
    font-family: sans-serif;
    background: linear-gradient(rgb(0,0,0,0.5), rgb(0,0,0,0.5)), url("./img/mathew-macquarrie-u6OnpbMuZAs-unsplash.jpg");
    height: 100vh;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.formbox{
    /* border: 3px solid white; */
    width: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.formbox h1{
    color: white;
    font-size: 6rem;
    margin-bottom: 2rem;
   
}

.formbox p{
    color: white;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.formbox .username-box, .formbox .password-box{
    overflow: hidden;
    width: 100%;
    font-size: 2.5rem;
    padding: 0.8rem 0rem;
    margin: 0.8rem 0rem;

}

.username-box::after{
    content: " ";
    display: Block;
    border-bottom: 2px solid white;
    width: 200px;
    margin-left: 28rem;
   
}
.password-box::after{
    content: " ";
    display: Block;
    border-bottom: 2px solid white;
    width: 200px;
    margin-left: 28rem;
}

.username-box .username, .password-box .password{
    border: none;
    outline: none;
    background: none;
    color: white;

}



.formbox .btn{
    font-size: 2rem;
    padding: 0.8rem 2rem;
    border-radius: 28px;
    border: 0;
    color: rgb(255, 255, 255);
    background-color: coral;
}

.btn:hover{
    background-color: greenyellow;
    color: rgb(0, 0, 0);
    padding: 2rem 3rem;
    border-radius: 30px;

}

@media(max-width:500px){
    html{
        font-size: 50%;
    }

    .formbox h1{
        font-size: 3.5rem;
    }

    .username-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 200px;
        margin-left: 0.5rem;
       
    }
    .password-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 200px;
        margin-left: 0.5rem;
    }
   
}


@media(max-width:400){
    html{
        font-size: 52%;
    }

    .formbox h1{
        font-size: 3.5rem;
    }

    .username-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:6rem;
       
    }
    .password-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:6rem;
    }
   
}



@media(min-width:401px) and (max-width:670px){
    html{
        font-size: 52%;
    }

    .formbox h1{
        font-size: 3.5rem;
    }

    .username-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:6rem;
       
    }
    .password-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:6rem;
    }
   
}


@media(min-width:671px) and (max-width:768px){
    html{
        font-size: 52%;
    }

    .formbox h1{
        font-size: 3.5rem;
    }

    .username-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:10rem;
       
    }
    .password-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:10rem;
    }
   
}


@media(min-width:769px) and (max-width:900px){
    html{
        font-size: 55%;
    }

    .formbox h1{
        font-size: 3.5rem;
    }

    .username-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:14rem;
       
    }
    .password-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:14rem;
    }
   
}

@media(min-width:901px) and (max-width:1000px){
    html{
        font-size: 55%;
    }

    .formbox h1{
        font-size: 3.5rem;
    }

    .username-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:18rem;
       
    }
    .password-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:18rem;
    }
   
}

@media(min-width:1001px) and (max-width:1200px){
    html{
        font-size: 55%;
    }

    .formbox h1{
        font-size: 3.5rem;
    }

    .username-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:22rem;
       
    }
    .password-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:22rem;
    }
   
}


@media(min-width: 1201px) and (max-width:1300px){
    .formbox h1{
        font-size: 4rem;
    }

    .username-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:22rem;
       
    }
    .password-box::after{
        content: " ";
        display: Block;
        border-bottom: 2px solid white;
        width: 180px;
        margin-left:22rem;
    }
}


@media (orientation: landscape) and (max-height:500px){
    .background{
        height: 90vmax;
    }
}

Comments

Popular posts from this blog

Gsap effect on click

Gsap timeline position parameters

Scroll magic javascript