Create a responsive contact form using HTML and CSS

Responsive Contact us form using HTML and CSS

index.html

<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="style.css" type="text/css">

    </head>

    <body>
        <div class="main">
            <div class="container">
                <h3>Contact Us</h3>
                <div class="form">
                    <form action="" method="post">
                        <input type="text" name="firstname" placeholder="First Name"> <br>
                        <input type="text" name="lastname" placeholder="Last Name">  <br>
                        <input type="email" name="email" placeholder="Email">  <br>
                        <textarea name="message" placeholder="write your message here.."></textarea>
                        <br>
                        <button type="submit">submit</button>
                    </form>


                </div>


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

style.css

body{
    padding: 0;
    margin: 0;
}

.main{
    width: 100%;
    min-height: 100vh;
    display: flex;
    background-image: url("abstract_green_swirl_floral_vector_background_148421.jpg");
    background-repeat: no-repeat;
    background-size: cover;
    justify-content: center;
   
}
.container{
    width:50%;
    color: white;
    background: rgb(0, 60, 100);
    padding: 40px;
   
}
.form{
    background-color: white;
    padding: 15px;
    margin-bottom: 30px;
    text-align: center;
    border-radius: 14px;
}

.form input{
    height: 30px;
    width: 90%;
    padding: 5px;
    margin-top: 30px;
}
.form textarea{
    width: 90%;
    height: 50px;
    margin-top: 30px;
    margin-bottom: 30px;
    padding: 5px;
}

.form button{
    margin-bottom: 30px;
    padding: 5px;
    background-color: #2e7c31;
    border: none;
    font-size: 1.5em;
    color: #ffffff;
    box-shadow: 1px 1px 3px green;
}
@media  (max-width: 650px) {
    .container{
        width: 100%;
    }
}

output:






Comments

Popular Posts