[์น ํดํน/ 1์ฃผ์ฐจ] <HTML, CSS, JavaScript> - ๋ก๊ทธ์ธ, ํ์๊ฐ์ ํ์ด์ง ๊ตฌํ
๐บ ์์ฐ ์์
๋์์ ์๋น์ค๊ฐ ์ข ๋ฃ๋์ด ํด๋น ์ฝํ ์ธ ๋ฅผ ์ฌ์ํ ์ ์์ต๋๋ค.
์์ ๊ฐ๋จ ์์ฝ
1. ๋นํ์์ผ ์ ํ์๊ฐ์ ํ์ด์ง๋ก ์ด๋
2. ์ ๋ณด ์ ๋ ฅ ์ค ๋ฆฌ์ ๊ฐ๋ฅ
3. ํ์ ์ ๋ณด ๋ฏธ์ ๋ ฅ ์ ํ์๊ฐ์ ๋ถ๊ฐ
4. ๊ด์ฌ ๋ถ์ผ๋ ๋ณต์ ์ ํ ๊ฐ๋ฅ โก๏ธ <input type="checkbox">
5. ์ฑ๋ณ์ ๋จ์ผ ์ ํ ๊ฐ๋ฅ โก๏ธ <input type="radio">
6. ํ์ ์ ๋ณด ๋ชจ๋ ์ ๋ ฅ ์ ํ์๊ฐ์ ์ฑ๊ณต ์๋ฆผ ๋จ๋ฉฐ ๋ก๊ทธ์ธ ํ์ด์ง๋ก ์ด๋
7. ์์ด๋, ํจ์ค์๋ ์ ๋ณด ์ ๋ ฅ ํ ๋ก๊ทธ์ธ ๋ฒํผ ๋๋ฅด๋ฉด welcome ํ์ด์ง๋ก ์ด๋
๊ณ์ ์์ ์ค์ด๋ผ ์ฃผ์์ด ๋ง์ ์ ์ฃผ์,,
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๋ก๊ทธ์ธ ํ์ด์ง</title>
<link rel="stylesheet" href="login.css">
</head>
<body>
<div class="container">
<div class="image-container">
<img src="login.png" alt="๋ก๊ทธ์ธ ์ด๋ฏธ์ง">
</div>
<div class="login-container">
<h2>๋ก๊ทธ์ธ</h2>
<form action="welcome.html" method="post">
<input type="text" name="username" placeholder="์์ด๋" required>
<input type="password" name="password" placeholder="๋น๋ฐ๋ฒํธ" required>
<button type="submit">๋ก๊ทธ์ธ</button>
</form>
<p class="signup-link">ํ์์ด ์๋์ ๊ฐ์? <a href="register.html">ํ์๊ฐ์
</a></p>
</div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
/* height: 100vh;
background-color: #f0f0f0; */
margin: 0; /* ์ถ๊ฐ */
}
.container {
display: flex; /* ์ถ๊ฐ: Flexbox๋ก ์ข์ฐ ๋ฐฐ์น */
width: 80%;
height: 80vh;
max-width: 1200px;
margin: auto;
/* background-color: white;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1); */
}
.image-container {
flex: 1; /* ์์ : width ๋์ flex ์ฌ์ฉ */
display: flex; /* ์ถ๊ฐ: ์ค์ ์ ๋ ฌ์ ์ํ flexbox */
justify-content: center; /* ์ถ๊ฐ: ์ด๋ฏธ์ง ์ค์ ์ ๋ ฌ */
align-items: center; /* ์ถ๊ฐ: ์ด๋ฏธ์ง ์ค์ ์ ๋ ฌ */
padding: 20px; /* ์ถ๊ฐ: ์ด๋ฏธ์ง ์ฃผ๋ณ ํจ๋ฉ */
}
.image-container img {
width: 100%; /* ์์ : ๊ฐ๋ก ์ ์ฒด๋ฅผ ์ฑ์ฐ๋๋ก ์ค์ */
height: auto; /* ์์ : ๋์ด ๋น์จ ์๋ ์กฐ์ */
max-height: 100%; /* ์ถ๊ฐ: ๋์ด๋ฅผ ๋ถ๋ชจ ์ปจํ
์ด๋์ ๋ง์ถค */
object-fit: contain; /* ์์ : ์ด๋ฏธ์ง ๋น์จ ์ ์ง ๋ฐ ํฌ๊ธฐ ์กฐ์ */
}
.login-container {
flex: 1; /* ์์ : width ๋์ flex ์ฌ์ฉ */
display: flex;
flex-direction: column;
justify-content: center; /* ์์ : ์ธ๋ก ๊ฐ์ด๋ฐ ์ ๋ ฌ */
padding: 20px 40px; /* ์์ : padding ์กฐ์ */
}
.login-container h2 {
margin-bottom: 20px;
font-size: 24px;
text-align: center;
}
.login-container form {
display: flex;
flex-direction: column;
align-items: center;
}
.login-container input {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
.login-container button {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
font-size: 18px;
cursor: pointer;
transition: background-color 0.3s;
}
.login-container button:hover {
background-color: #45a049;
}
.signup-link {
margin-top: 20px;
text-align: center;
font-size: 14px;
}
.signup-link a {
color: #007BFF;
text-decoration: none;
}
.signup-link a:hover {
text-decoration: underline;
}
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ํ์๊ฐ์
ํ์ด์ง</title>
<link rel="stylesheet" href="register.css">
</head>
<body>
<div class="signup-container">
<h2>ํ์๊ฐ์
์ ์ํด ์๋ ์ ๋ณด๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.</h2>
<form id="signup-form" action="login.html" method="post">
<input type="text" name="name" placeholder="์ด๋ฆ" required>
<input type="date" name="birthdate" required>
<input type="text" name="username" placeholder="์์ด๋" required>
<input type="password" name="password" placeholder="๋น๋ฐ๋ฒํธ" required>
<div class="interest-group">
<label>๊ด์ฌ๋ถ์ผ:</label>
<label><input type="checkbox" name="interest" value="web"> ์น</label>
<label><input type="checkbox" name="interest" value="system"> ์์คํ
</label>
<label><input type="checkbox" name="interest" value="reversing"> ๋ฆฌ๋ฒ์ฑ</label>
</div>
<div class="gender-group">
<label>์ฑ๋ณ:</label>
<label><input type="radio" name="gender" value="female" required> ์ฌ์ฑ</label>
<label><input type="radio" name="gender" value="male"> ๋จ์ฑ</label>
<label><input type="radio" name="gender" value="none"> ์ ํ ์ํจ</label>
</div>
<textarea name="introduction" placeholder="ํ์ค ์๊ฐ" rows="3"></textarea>
<div class="button-group">
<button type="reset" class="reset-button">์ ๋ณด ๋ฆฌ์
</button>
<button type="submit" class="submit-button">ํ์๊ฐ์
ํ๊ธฐ</button>
</div>
</form>
</div>
<script src="register.js"></script> <!-- JavaScript ํ์ผ ์ถ๊ฐ -->
</body>
</html>
document.getElementById('signup-form').addEventListener('submit', function(event) {
event.preventDefault(); // ๊ธฐ๋ณธ ์ ์ถ ๋์์ ๋ง์
// ํ์ ์
๋ ฅ๊ฐ์ด ๋ชจ๋ ์ฑ์์ก๋์ง ํ์ธ
var form = event.target;
var name = form.name.value.trim();
var birthdate = form.birthdate.value;
var username = form.username.value.trim();
var password = form.password.value.trim();
var gender = form.gender.value;
if (name && birthdate && username && password && gender) {
alert("ํ์๊ฐ์
์๋ฃ!");
form.submit(); // ๋ชจ๋ ๊ฒ์ด ์ ํจํ๋ค๋ฉด ํผ ์ ์ถ
} /*else {
alert("๋ชจ๋ ํ์ ์ ๋ณด๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.");
}*/
});
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
.signup-container {
width: 40%;
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
text-align: center;
}
.signup-container h2 {
margin-bottom: 20px;
font-size: 20px;
color: #333;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
form input[type="text"],
form input[type="password"],
form input[type="date"],
form textarea {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
form textarea {
resize: none;
}
.interest-group,
.gender-group {
width: 100%;
margin-bottom: 15px;
text-align: left;
}
.interest-group label,
.gender-group label {
margin-right: 10px;
}
.button-group {
display: flex;
justify-content: space-between;
width: 100%;
}
.reset-button {
width: 48%;
padding: 10px;
background-color: #d3d3d3;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
.reset-button:hover {
background-color: #c0c0c0;
}
.submit-button {
width: 48%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
.submit-button:hover {
background-color: #45a049;
}
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๋ก๊ทธ์ธ ์ฑ๊ณต ํ์ด์ง</title>
</head>
<body>
<h1>Welcome!</h1>
</body>| [์น ํดํน/ 6์ฃผ์ฐจ] ๋๋ฆผํต ์๊ฒ์ devtools-sources (0) | 2024.09.30 |
|---|---|
| [์น ํดํน/ 2์ฃผ์ฐจ] PHP ๊ฐ๋ ์ ๋ฆฌ, ๊ฐ๋ฐ ํ๊ฒฝ ์ธํ (XAMPP) (0) | 2024.08.25 |
| [Linux/ ๋ฆฌ๋ ์ค] Week4 ๊ณผ์ (0) | 2024.08.17 |
| [Python/ ํ์ด์ฌ] ๋ฐฑ์ค 10988, 10807, 10813 ๋ฌธ์ ํ์ด (0) | 2024.08.17 |
| [Linux/ ๋ฆฌ๋ ์ค] Week 3 ๊ณผ์ (0) | 2024.08.17 |