728x90
๋ฐ์ํ
HTML ์์ฑ
HTML ์์ฑ์ HTML ์์์ ์ถ๊ฐ ์ ๋ณด๋ฅผ ์ ๊ณตํ๋ฉฐ, ์์์ ์์ ํ๊ทธ ๋ด์ ์ ์๋ฉ๋๋ค.
๊ธ๋ก๋ฒ ์์ฑ (๋ชจ๋ HTML ์์์์ ์ฌ์ฉ ๊ฐ๋ฅ)
์์ฑ | ์ค๋ช | ์์ |
---|---|---|
id |
์์์ ๊ณ ์ ์๋ณ์ | <div id="header"> |
class |
์์์ ํด๋์ค๋ช (CSS, JS์์ ์ฌ์ฉ) | <p class="intro"> |
style |
์ธ๋ผ์ธ CSS ์คํ์ผ | <h1 style="color:blue;"> |
title |
์์์ ๋ํ ์ถ๊ฐ ์ ๋ณด (ํดํ) | <span title="๋์๋ง"> |
hidden |
์์๋ฅผ ํ๋ฉด์ ํ์ํ์ง ์์ | <div hidden> |
data-* |
์ฌ์ฉ์ ์ง์ ๋ฐ์ดํฐ ์์ฑ | <div data-user="๊น์ฒ ์"> |
lang |
์์์ ์ธ์ด ์ง์ | <p lang="ko"> |
dir |
ํ ์คํธ ๋ฐฉํฅ ์ค์ | <p dir="rtl"> |
tabindex |
ํญ ํค๋ก ์ด์ ์ด๋ ์์ | <button tabindex="1"> |
contenteditable |
์์๋ฅผ ํธ์ง ๊ฐ๋ฅํ๊ฒ ํจ | <div contenteditable="true"> |
์ฃผ์ HTML ์์๋ณ ์์ฑ
๋งํฌ (<a>
)
<a href="https://example.com" target="_blank" rel="noopener">๋งํฌ</a>
href
: ๋งํฌ ๋์ URLtarget
: ๋งํฌ๋ฅผ ์ฌ๋ ๋ฐฉ์ (_blank
,_self
,_parent
,_top
)rel
: ํ์ฌ ๋ฌธ์์ ๋งํฌ๋ ๋ฌธ์์ ๊ด๊ณdownload
: ๋งํฌ๋ฅผ ๋ค์ด๋ก๋๋ก ์ฒ๋ฆฌ
์ด๋ฏธ์ง (<img>
)
<img src="image.jpg" alt="์ค๋ช
" width="300" height="200" loading="lazy">
src
: ์ด๋ฏธ์ง ํ์ผ ๊ฒฝ๋กalt
: ๋์ฒด ํ ์คํธwidth
,height
: ์ด๋ฏธ์ง ํฌ๊ธฐloading
: ์ด๋ฏธ์ง ๋ก๋ฉ ๋ฐฉ์ (lazy
,eager
)
ํผ ์์
<input type="text" name="username" placeholder="์ฌ์ฉ์ ์ด๋ฆ" required>
<textarea rows="4" cols="50" maxlength="200"></textarea>
<select multiple>
<option value="1" selected>์ต์
1</option>
</select>
type
: ์ ๋ ฅ ํ๋ ์ ํ (text
,password
,email
,number
๋ฑ)name
: ํผ ๋ฐ์ดํฐ์ ์ด๋ฆplaceholder
: ์ ๋ ฅ ํ๋์ ํํธrequired
: ํ์ ์ ๋ ฅ ํ๋disabled
: ๋นํ์ฑํreadonly
: ์ฝ๊ธฐ ์ ์ฉmin
,max
: ์ซ์ ์ ํmaxlength
: ์ต๋ ๋ฌธ์ ์multiple
: ๋ค์ค ์ ํ ๊ฐ๋ฅselected
: ๊ธฐ๋ณธ ์ ํ๋ ์ต์
CSS ์์ฑ
๋ ์ด์์ ๋ฐ ๋ฐ์ค ๋ชจ๋ธ
ํฌ๊ธฐ ์์ฑ
.box {
width: 200px;
height: 100px;
min-width: 100px;
max-width: 300px;
box-sizing: border-box;
}
์ฌ๋ฐฑ๊ณผ ํจ๋ฉ
.container {
margin: 10px 20px 30px 40px; /* ์ ์ฐ ํ ์ข */
padding: 10px; /* ๋ชจ๋ ๋ฐฉํฅ */
padding-top: 20px; /* ํน์ ๋ฐฉํฅ */
}
ํ ๋๋ฆฌ
.element {
border: 1px solid black;
border-radius: 5px;
border-width: 2px;
border-style: dashed;
border-color: red;
}
์์น ์ง์
.positioned {
position: relative; /* static, absolute, fixed, sticky */
top: 10px;
left: 20px;
z-index: 100;
}
๋์คํ๋ ์ด
.element {
display: flex; /* block, inline, none, grid, inline-block */
visibility: visible; /* hidden */
overflow: auto; /* visible, hidden, scroll */
}
ํ ์คํธ ๋ฐ ํฐํธ
.text {
font-family: 'Arial', sans-serif;
font-size: 16px;
font-weight: bold; /* normal, 100~900 */
font-style: italic;
color: #333;
text-align: center; /* left, right, justify */
text-decoration: underline; /* none, line-through, overline */
text-transform: uppercase; /* lowercase, capitalize */
line-height: 1.5;
letter-spacing: 1px;
word-spacing: 2px;
white-space: nowrap; /* normal, pre, pre-wrap */
text-shadow: 1px 1px 2px gray;
}
๋ฐฐ๊ฒฝ
.background {
background-color: #f5f5f5;
background-image: url('image.jpg');
background-repeat: no-repeat;
background-position: center;
background-size: cover; /* contain, auto, 100% 100% */
background-attachment: fixed; /* scroll, local */
/* ๋จ์ถ ์์ฑ */
background: #f5f5f5 url('image.jpg') no-repeat center/cover;
}
ํธ๋์ง์ ๋ฐ ์ ๋๋ฉ์ด์
.transition {
transition-property: all;
transition-duration: 0.3s;
transition-timing-function: ease-in-out;
transition-delay: 0.1s;
/* ๋จ์ถ ์์ฑ */
transition: all 0.3s ease-in-out 0.1s;
}
@keyframes slide {
0% { transform: translateX(0); }
100% { transform: translateX(100px); }
}
.animation {
animation-name: slide;
animation-duration: 2s;
animation-timing-function: ease;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-fill-mode: forwards;
/* ๋จ์ถ ์์ฑ */
animation: slide 2s ease 0s infinite alternate forwards;
}
Flexbox
.flex-container {
display: flex;
flex-direction: row; /* column, row-reverse, column-reverse */
flex-wrap: wrap; /* nowrap, wrap-reverse */
justify-content: space-between; /* flex-start, flex-end, center, space-around */
align-items: center; /* flex-start, flex-end, stretch, baseline */
align-content: space-between; /* flex-start, flex-end, center, space-around, stretch */
gap: 10px;
}
.flex-item {
flex-grow: 1;
flex-shrink: 0;
flex-basis: auto; /* ๊ธฐ๋ณธ ํฌ๊ธฐ */
align-self: flex-start; /* flex-end, center, stretch */
/* ๋จ์ถ ์์ฑ */
flex: 1 0 auto; /* grow shrink basis */
order: 2; /* ์์์ ์์ */
}
Grid
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 100px auto;
grid-template-areas:
"header header header"
"sidebar content content";
grid-column-gap: 10px;
grid-row-gap: 15px;
/* ๋จ์ถ ์์ฑ */
grid-gap: 15px 10px; /* row column */
justify-items: center; /* start, end, stretch */
align-items: center;
justify-content: space-between;
align-content: space-around;
}
.grid-item {
grid-column: 1 / 3; /* start / end */
grid-row: 1 / 2;
grid-area: header; /* ํ
ํ๋ฆฟ ์์ญ ์ด๋ฆ */
justify-self: center;
align-self: center;
}
๋ฏธ๋์ด ์ฟผ๋ฆฌ
@media screen and (max-width: 768px) {
.responsive {
flex-direction: column;
}
}
@media (prefers-color-scheme: dark) {
body {
background-color: #333;
color: white;
}
}
728x90
๋ฐ์ํ
'๐ HTML,CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
HTML&CSS 1์ผ์ฐจ (์ ๋ฆฌx) (0) | 2024.03.23 |
---|---|
HTML&CSS ์ค์ต11 (์ ๋ฆฌx) (0) | 2024.03.23 |
HTML&CSS ์ค์ต10 (์ ๋ฆฌx) (0) | 2024.03.23 |
HTML&CSS ์ค์ต9 (์ ๋ฆฌx) (0) | 2024.03.23 |
HTML&CSS ์ค์ต8 (์ ๋ฆฌx) (0) | 2024.03.23 |