기본적인 form 양식 style 코드 :
<style>
form {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background-color: #f2f2f2;
border-radius: 5px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"],
input[type="email"],
textarea {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: none;
border-radius: 5px;
background-color: #fff;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
}
input[type="submit"] {
display: block;
width: 100%;
padding: 10px;
border: none;
border-radius: 5px;
background-color: #4CAF50;
color: #fff;
font-size: 16px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
<style>
<!DOCTYPE html>
<html>
<head>
<title>My Form</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<input type="submit" value="Submit">
</form>
</body>
</html>
폼 태그만 :
<style>
form {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50px;
}
label {
font-size: 18px;
margin-bottom: 10px;
}
input,
textarea {
padding: 10px;
border: 2px solid #ccc;
border-radius: 5px;
width: 100%;
margin-bottom: 20px;
}
button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 18px;
}
button:hover {
background-color: #3e8e41;
}
</style>
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<button type="submit">Submit</button>
</form>
Preview <form></form> Code Sample:
'구글덕후의 HTML' 카테고리의 다른 글
div 색상변경 샘플 코드 (0) | 2023.03.18 |
---|---|
구글덕후의 HTML [5] form양식, label, input (0) | 2023.03.12 |
구글덕후의 HTML [4] 심플랜딩페이지 / 구글 사이트 도구 (0) | 2023.03.11 |
구글덕후의 HTML [3] 심플랜딩페이지 (0) | 2023.03.07 |
구글덕후의 HTML [2] 테이블 (0) | 2023.03.06 |