본문 바로가기
프로그래밍/Web

[Web] form 태그를 활용하여 contact us 페이지 만들기

by JR2 2022. 5. 4.

 

 

요런 페이지를 만들어보자.

코딩애플 숙제다.

 


<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="./assets/style.css" />
    </head>

    <body>
        <div class="container">
            <div class="marg-left marg-top">
                <h2 class="f-black">contact us</h2>
            </div>
            <form action="" class="f-black wh100">
                <div class="marg-top marg-left">
                    <h4 class="f-margin">Your Email</h4>
                    <input type="email" placeholder="email@example.com" class="mid-btn btn-email"></input>
                </div>
                <div class="btn-name marg-top marg-left">
                    <div class="float-left">
                        <h4 class="f-margin">First name</h4>
                        <input type="text" class="mid-btn w55"></input>
                    </div>
                    <div class="float-left marg-left">
                        <h4 class="f-margin">Last name</h4>
                        <input type="text" class="mid-btn w55"></input>
                    </div>
                </div>
                <div style="clear: both;"></div>
                <div class="marg-top marg-left">
                    <h4>Message</h4>
                    <textarea name="" id="" cols="38" rows="12"></textarea>
                </div>
                <div class="marg-top marg-left">
                    <input id="subscribe" type="checkbox" class="float-left">
                    <label for="subscribe" class="float-left">Subscribe</label>
                    <button class="mid-btn" style="display: block; margin-left: auto; margin-right: 50px;">SEND</button>
                </div>
            </form>
        </div>
    </body>
</html>
.container {
    width: 400px;
    height: 600px;
    padding: 1px;
    background-color: white;
}

h4{
    margin: 0px;
}

.wh100{
    width: 100%;
    height: 100%;
}

.w55{
    width: 55%;
}

.marg-left{
    margin-left: 30px;
}

.marg-top{
    margin-top: 30px;
}

.f-black{
    color: black;
}

.f-margin{
    margin-bottom: 10px;
}

.mid-btn{
    padding: 10px;
}

.lrg-btn{
    padding: 90px;
}

.btn-email{
    width: 80%;
}

.btn-name{
    width: 100%;
    float: left;
}

.float-left{
    float: left;
}

 

재미있는건 label 태그이다.

<input id="subscribe" type="checkbox" class="float-left">
<label for="subscribe" class="float-left">Subscribe</label>

 

 

label 태그와 input의 checkbox를 for, id로 묶게되면

label을 눌러도 check가 된다.

 

See the Pen Coding Apple Html/Css Homework1 by Jirong (@jirongkim) on CodePen.

 

댓글