๊ธฐ๋ณธ ์ ํ์
์ ํ์ ์ข
๋ฅ | ์ ์ | ๊ธฐํธ | ์์ ์ฝ๋ |
์ ์ฒด ์ ํ์ | ๋ชจ๋ ์์๋ฅผ ์ ํํ๋ ์ ํ์ | * | * { margin: 0; padding: 0; } |
ํ๊ทธ ์ ํ์ | ํน์ HTML ํ๊ทธ๋ฅผ ์ ํํ๋ ์ ํ์ | ํ๊ทธ๋ช
| p { color: red; } |
ํด๋์ค ์ ํ์ | ํน์ ํด๋์ค ์ด๋ฆ์ ๊ฐ์ง ์์๋ฅผ ์ ํํ๋ ์ ํ์ | .ํด๋์ค๋ช
| .button { background-color: blue; } |
์์ด๋ ์ ํ์ | ํน์ ์์ด๋๋ฅผ ๊ฐ์ง ์์๋ฅผ ์ ํํ๋ ์ ํ์ | #์์ด๋๋ช
| #header { background-color: green; } |
๊ทธ๋ฃน ์ ํ์ | ์ฌ๋ฌ ์ ํ์๋ฅผ ๋ฌถ์ด ๋์ผํ ์คํ์ผ์ ์ ์ฉ | ์ ํ์1, ์ ํ์2 | h1, h2, h3 { color: purple; } |
๊ธฐ๋ณธ ์ ํ์
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๊ธฐ๋ณธ ์ ํ์</title>
<style>
/* ์ ์ฒด ์ ํ์ : * */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* ํ๊ทธ ์ ํ์ : ํ๊ทธ์ด๋ฆ */
body {
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}
/* id ์ ํ์ : #์์ด๋ */
#title {
font-size: 40px; /* fz40 */
margin-bottom: 20px; /* mb20 */
}
/* class ์ ํ์ : .ํด๋์ค */
.btn {
padding: 10px 12px; /* p10-12 */
text-decoration: none; /* tdn */
color: white; /* c:white */
background-color: royalblue; /* backco */
border-radius: 6px; /* borr */
}
/* ๊ทธ๋ฃน ์ ํ์ : ์ ํ์1, ์ ํ์2, ... */
.btn, .text {
font-size: 16px;
}
p {
margin: 20px;
}
</style>
</head>
<body>
<h1 id="title">์ ๋ชฉ ์
๋๋ค.</h1>
<a href="" class="btn">๋ฒํผ1</a>
<a href="" class="btn">๋ฒํผ2</a>
<a href="" class="btn">๋ฒํผ3</a>
<a href="" class="btn">๋ฒํผ4</a>
<a href="" class="btn">๋ฒํผ5</a>
<p class="text">๋ฌธ์ฅ ์
๋๋ค.</p>
</body>
</html>
HTML
๋ณต์ฌ
๊ฒ์ํ ๊ธ์ฐ๊ธฐ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๊ฒ์ํ ๊ธ์ฐ๊ธฐ</title>
<style>
/* ์ ์ฒด์ ์ธ ๋ ์ด์์ */
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
.container {
width: 80%;
max-width: 800px;
margin: 50px auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
/* ์ ๋ชฉ ์คํ์ผ */
h1 {
text-align: center;
color: #333;
}
/* ํผ ์คํ์ผ */
.form-group { margin-bottom: 15px; }
label {
display: block;
font-weight: bold;
margin-bottom: 5px;
}
input[type="text"],
textarea {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
button {
width: 100%;
padding: 10px;
background-color: royalblue;
color: white;
border-radius: 4px;
border: none;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h1>๊ฒ์ํ ๊ธ์ฐ๊ธฐ</h1>
<form action="" method="post">
<div class="form-group">
<label for="title">์ ๋ชฉ</label>
<input type="text" id="title" name="title" required>
</div>
<div class="form-group">
<label for="writer">์์ฑ์</label>
<input type="text" id="writer" name="writer" required>
</div>
<div class="form-group">
<label for="content">๋ด์ฉ</label>
<textarea name="content" id="content"
rows="10" required></textarea>
</div>
<div class="form-group">
<button type="submit">์์ฑํ๊ธฐ</button>
</div>
</form>
</div>
</body>
</html>
HTML
๋ณต์ฌ