<form>
태그를 이용해 Contact Us 레이아웃 섹션을 만들어 보았다.
<div>
태그를 이용해 박스 디자인을 한다. (빨간색 테두리)<form>
태그<form action="">
작성한 내용이 어떤 서버경로로 전달될지
<form method="">
작성한 내용이 어떤 방식으로 서버에 전달될지
<input>
태그<input type="">
<input value="미리 채워진 값">
<input placeholder="미리 채워진 값인데 배경 글자">
<input name="인풋 이름">
<-- 서버 개발시 필요
<input>
스타일링
input[속성명=속성값]
input[type=text]
<select>
<option></option>
</select>
<textarea></textarea>
<label>
태그와 for 속성<input type="checkbox" id="subscribe">
<label for="subscribe"> 누르기 </label>
<!-- layout3.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">
<link rel="stylesheet" href="./layout3.css">
<title>Document</title>
</head>
<body>
<div class="form-background">
<div class="form-white">
<form action="">
<div>
<p>Contact us</p>
</div>
<div>
<p>Your Email</p>
<input class="form-input" placeholder="email@example.com" type="email">
</div>
<div class="first-name">
<p>First name</p>
<input class="form-input" type="text">
</div>
<div class="first-name">
<p>Last name</p>
<input class="form-input" type="text">
</div>
<div class="last-name">
<p>Message</p>
<textarea cols="73" rows="5"></textarea>
</div>
<div>
<input id="sub" type="checkbox">
<label for="sub">Subscribe</label>
<button class="button">SEND</button>
</div>
</form>
</div>
</div>
</body>
</html>
// layout3.css
div, input, textarea {
box-sizing: border-box;
}
.form-background {
background-color: black;
padding: 30px;
}
.form-white {
background-color: white;
padding: 30px;
width: 80%;
max-width: 600px;
margin: auto;
}
.form-input {
width: 100%;
padding: 10px;
font-size: 20px;
border: 1px solid black;
border-radius: 5px;
}
.first-name {
width: 50%;
float: left;
padding: 10px;
}
.button {
width: 60px;
display: block;
margin-left: auto;
}