방법 - 문의 양식
CSS로 문의 양식을 만드는 방법을 알아보세요.
문의 양식을 만드는 방법
1단계) HTML 추가
<form> 요소를 사용하여 입력을 처리합니다. PHP 튜토리얼 에서 이에 대해 자세히 알아볼 수 있습니다 . 그런 다음 각 필드에 대한 입력(일치하는 레이블 포함)을 추가합니다.
예시
<div class="container">
<form action="action_page.php">
<label for="fname">First Name</label>
<input type="text"
id="fname" name="firstname" placeholder="Your name..">
<label for="lname">Last Name</label>
<input type="text"
id="lname" name="lastname" placeholder="Your last name..">
<label for="country">Country</label>
<select
id="country" name="country">
<option value="australia">Australia</option>
<option value="canada">Canada</option>
<option value="usa">USA</option>
</select>
<label for="subject">Subject</label>
<textarea
id="subject" name="subject" placeholder="Write something.."
style="height:200px"></textarea>
<input
type="submit" value="Submit">
</form>
</div>
2단계) CSS 추가:
예시
/* Style inputs with type="text", select elements and textareas */
input[type=text], select, textarea {
width: 100%; /*
Full width */
padding: 12px; /* Some padding */
border: 1px solid #ccc;
/* Gray border */
border-radius: 4px; /* Rounded borders */
box-sizing: border-box;
/* Make sure that padding and width stays in place */
margin-top: 6px; /* Add a top margin */
margin-bottom: 16px;
/* Bottom margin */
resize: vertical /* Allow the user
to vertically resize the textarea (not horizontally) */
}
/* Style the submit button with a specific background color etc */
input[type=submit] {
background-color: #04AA6D;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
/* When moving the mouse over the submit button,
add a darker green color */
input[type=submit]:hover {
background-color: #45a049;
}
/* Add a background color and some
padding around the form */
.container {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
팁: HTML 양식 에 대해 자세히 알아보려면 HTML 양식 자습서 로 이동하십시오 .
팁: 양식 요소의 스타일을 지정하는 방법에 대해 자세히 알아보려면 CSS 양식 자습서 로 이동하십시오 .
W3Schools Spaces 에 대해 들어본 적이 있습니까? 여기에서 웹사이트를 처음부터 만들거나 템플릿을 사용하여 무료로 호스팅할 수 있습니다.
무료로 시작하세요 ❯* 신용카드 불필요