[μΆμ²: νν 리μΌλ‘ λ°°μ°λ HTML & CSS]
[μΆμ²: νν 리μΌλ‘ λ°°μ°λ HTML & CSS]
μμ± | μ€λͺ |
---|---|
border-width | μ μ λκ»μ κ΄λ ¨λ μμ± |
border-style | μ μ λͺ¨μκ³Ό κ΄λ ¨λ μμ± |
border-color | μ μ μκΉκ³Ό κ΄λ ¨λ μμ± |
initial | κΈ°λ³Έκ°μΌλ‘ μ€μ |
inherit | λΆλͺ¨ μμμ μμ±κ°μ μμ |
/* μμ± μμ*/
border: border-width border-style border-color | initial | inherit
- λ§μ§ κ²ΉμΉ¨ νμ(margin collapsing)
- μμμ μμ μ¬μ΄μ margin-top/margin-bottomμ 곡κ°μ΄ μμ κ²½μ° λ λμ κ°μ λ§μ§ κ°λ§ μ μ©λλ νμ
- λΆλͺ¨ μμμ μμ μμκ° μ‘΄μ¬ν λ μμ μμμ margin-top/margin-bottom κ°μ λΆλͺ¨μ λμ΄μ μν₯μ λ―ΈμΉμ§ μλ νμ
<div class="parent"> <div class="child"></div> </div>
/* λΆλͺ¨μ λμ΄λ₯Ό μ§μ νμ§ μμΌλ©΄ μμμ λμ΄λ§νΌ λΆλͺ¨μ λμ΄κ° μ§μ λ¨ */ .parent { background-color: yellow; } /* μ΄ κ²½μ° μμμ margin-top κ°μ΄ λΆλͺ¨μ λμ΄μ μν₯μ λ―ΈμΉμ§ μμ */ .child { width: 100px; height: 100px; margin-top: 50px; background-color: red; }
μ΄λ° νμμ ν΄κ²°νμ§ μμΌλ©΄ λ΄κ° κ³νν UIμ λ€λ₯Έ UIκ° κ΅¬μ±λ μ μλ€.
- ν΄κ²° λ°©λ²
- λΆλͺ¨ μμμ overflor μμ± κ° μ μ©
- λΆλͺ¨ μμμ display:inline-block μ μ©
- λΆλͺ¨ μμμ borderκ° μ μ©
μμμ 컨ν
μΈ κ° λ무 컀λ€λ κ²½μ° μμλ₯Ό μ΄λ»κ² μ²λ¦¬ν μ§ μ§μ (overflow-x
, overflow-y
μ μΆ λ³λ‘ κ°μ μ€μ ν μ μλ€.)
μμ± | μ€λͺ |
---|---|
visible | κΈ°λ³Έκ°, μ½ν μΈ λ₯Ό μλ₯΄μ§ μλλ€. |
hidden | μ½ν
μΈ λ₯Ό μμμ ν¬κΈ°λ§νΌ λ§μΆκΈ° μν΄ μλΌλΈλ€. μ€ν¬λ‘€ λ° μ 곡X |
scroll | μ½ν
μΈ λ₯Ό μμμ ν¬κΈ°λ§νΌ λ§μΆκΈ° μν΄ μλΌλΈλ€. μλ €μ§ λλ¨Έμ§ λΆλΆμ νμΈν μ μλλ‘ μ€ν¬λ‘€ λ° μ 곡 O |
<img> νκ·Έ
λ₯Ό μ¬μ©νλ λ°©λ², CSS background μμ±
μ μ¬μ©νλ λ°©λ² λ κ°μ§λ₯Ό μ£Όλ‘ μ¬μ©.
<img>
νκ·Έ μ¬μ©
- λμμΈ μμμΈ λΏλ§ μλλΌ μ½ν μΈ μ ν λΆλΆμΌ κ²½μ°
- νμ΄μ§λ₯Ό μΈμν λ μ΄λ―Έμ§κ° ν¬ν¨λκΈΈ μν κ²½μ°
- κ²μ μμ§μμ μμΈνλ₯Ό μν κ²½μ° (ꡬκΈμ λ°°κ²½ μ΄λ―Έμ§λ₯Ό μλμΌλ‘ μμΈννμ§ μλλ€.)
<img>
νκ·Έλalt
μtitle
μμ±μ μ΄μ©νλ©΄ μ€ν¬λ¦°λ¦¬λκ° μΈμνλλ° λμμ΄ λλ€.- μ΄λ―Έμ§μ μ맨ν±ν μλ―Έκ° μλ κ²½μ°, μ¬μ©μμκ² μλ―Έ μ λ¬νκΈ° μ½λ€.
CSS background
μμ± μ¬μ©
- μ½ν μΈ μ μΌλΆκ° μλκ³ λμμΈμ μΈ μμλ‘λ§ μ¬μ©λλ κ²½μ°
- μΈμν λ μ΄λ―Έμ§κ° ν¬ν¨λμ§ μλλ‘ ν κ²½μ°
- CSS spritesλ₯Ό μ΄μ©ν΄ μ΄λ―Έμ§ μλλ₯Ό ν₯μμν¬ κ²½μ°
- μ΄λ―Έμ§ μμ ν μ€νΈκ° λ€μ΄κ° κ²½μ°
- background-size: coverλ₯Ό μ΄μ©ν΄ μλμ° μ 체λ₯Ό λ°°κ²½μ΄λ―Έμ§λ‘ μ±μΈ κ²½μ°
- λ°λ³΅λλ μ΄λ―Έμ§μΌ κ²½μ°
When to Use HTML<img>
Tag andCSS background-image Property
μμ± | μ€λͺ |
---|---|
background-image | URLμ μ΄μ©ν΄ μ΄λ―Έμ§μ μ£Όμμμ μ΄λ―Έμ§λ₯Ό λΆλ¬μ¨λ€. |
background-color | λ°°κ²½μμ μ§μ |
background-repeat | λ°°κ²½ μ΄λ―Έμ§μ λ°λ³΅μ μ§μ (repeat, no-repeat, repeat-x, repeat-y, round, space) |
background-position | λ°°κ²½ μ΄λ―Έμ§μ μμΉλ₯Ό μ§μ |
background-attachment | λ°°κ²½μ΄λ―Έμ§λ₯Ό κ³ μ μν¬ μ μλ€. |
μμ± | μ€λͺ |
---|---|
font-family | κΈκΌ΄ μ§μ |
font-size | κΈκΌ΄ ν¬κΈ° μ§μ |
font-weight | κΈκΌ΄ κ΅΅κΈ° μ§μ |
font-style | κΈκΌ΄ μ€νμΌ μ§μ |
text-transform | ν μ€νΈλ₯Ό λλ¬Έμ, μλ¬Έμλ‘ νν κ°λ₯ |
text-align | ν μ€νΈ μ λ ¬ |
text-decoration | ν μ€νΈλ₯Ό κΎΈλ° κ°λ₯ |
μΆμ² μΉ ν°νΈ μ¬μ΄νΈ
μΆμ² μΉ μμ΄μ½ μ¬μ΄νΈ
ν°νΈλ₯Ό ꡬννλ λ°©λ², λΈλΌμ°μ λ³λ‘ μλ‘ λ€λ₯Έ ν¬λ§·μ μ§μνκΈ° λλ¬Έμ λΈλΌμ°μ λ³ μ§μ μ 보λ₯Ό μμ λ νμκ° μλ€.
edt | λ§μ΄ν¬λ‘μννΈκ° μΉμμ μ¬μ©νκΈ° μν΄ μ μν ν¬λ§·(IEλ§ μ§μ) |
woff | μ¬λ¬ νμ¬λ€μ νμ μΌλ‘ μ μλ ν¬λ§·, κ°μ₯ λ리 μ¬μ© |
woff2 | woffλ₯Ό κ°μ νμ¬ 30%μ λ λ μμ κΈκΌ΄ νμΌλ‘ μμΆ κ°λ₯(ν°νΈ μ©λμ μ€μ΄λλ° ν¨κ³Όμ ) |
ttf | μ νκ³Ό λ§μ΄ν¬λ‘μννΈκ° κ³ μν λ²‘ν° ν¬λ§·(λλΆλΆμ μΉ λΈλΌμ°μ μμ μ§μ) |
otf | μ΄λλΉμ λ§μ΄ν¬λ‘μννΈκ° μ½λ ₯ν΄μ λ§λ ttf κ°μ ν |
svg | λ²‘ν° λ°μ΄ν°λ₯Ό μ μ₯νλ svgλ₯Ό νμ©ν κΈκΌ΄ νν |
[μΆμ²: νν 리μΌλ‘ λ°°μ°λ HTML & CSS]
νν λ°©λ²: black, #000, #000000, rgb(0, 0, 0), rgba(0, 0, 0, 0.8), transparent
μμ μ΄λ¦ | λΈλΌμ°μ λ 140κ°μ§ μμ μ΄λ¦μ μ§μ(λ€λ₯Έ νν λ°©μμ λΉν΄ μκ° μ νμ ) https://www.w3schools.com/colors/colors_names.asp |
RGB | λΉμ 3 μμμΈ Red, Green, Blueλ₯Ό νΌν©νμ¬ 0~255μ κ°μΌλ‘ μ νν |
HEX (16μ§μ) | 16μ§μ 6μ리 μ½λλ‘ μ νν 6μ리 μ½λλ κ°κ° 2μλ¦¬μ© Red, Green, Blueμ λν κ°μ νν |
[μΆμ²: νν 리μΌλ‘ λ°°μ°λ HTML & CSS]
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>character</title>
<link rel="stylesheet" href="character.css" />
</head>
<body>
<div class="container">
<div class="face">
<div class="mouth"></div>
<div class="face-right"></div>
<div class="eye-left"></div>
<div class="eye-right"></div>
<div class="nose"></div>
<div class="cheek"></div>
</div>
<div class="ear"></div>
<div class="ear-line"></div>
<div class="hair-left"></div>
<div class="hair-right"></div>
<div class="hair-line"></div>
<div class="beanie-container">
<div class="beanie-left"></div>
<div class="beanie-right"></div>
</div>
<div class="mouth"></div>
</div>
</body>
</html>
@import "../reset.css";
:root {
--face-color: #ffd0c0;
--border: 10px solid #333;
}
.container {
position: relative;
top: 100px;
left: 100px;
}
.face {
position: relative;
width: 300px;
height: 300px;
border: var(--border);
border-radius: 100%;
background-color: var(--face-color);
}
.eye-left,
.eye-right {
position: absolute;
top: 120px;
right: 15px;
width: 25px;
height: 45px;
border-radius: 100%;
background-color: #333;
}
.eye-left {
right: 90px;
}
.face-right {
position: absolute;
top: 120px;
right: -25px;
width: 180px;
height: 160px;
border: var(--border);
border-radius: 100%;
background-color: var(--face-color);
}
.face-right::after {
content: "";
position: absolute;
top: -130px;
right: 15px;
width: 300px;
height: 300px;
border-radius: 100%;
background-color: var(--face-color);
}
.nose {
position: absolute;
right: 50px;
bottom: 90px;
z-index: 10;
width: 35px;
height: 35px;
border-top: var(--border);
border-top-left-radius: 35px;
border-top-right-radius: 35px;
transform: rotate(100deg);
}
.cheek {
position: absolute;
bottom: 90px;
left: 120px;
z-index: 10;
width: 55px;
height: 35px;
border-radius: 100%;
background-color: #f28888;
}
.mouth {
position: absolute;
left: 220px;
bottom: 60px;
width: 45px;
height: 40px;
border-top: var(--border);
border-top-left-radius: 200px;
border-top-right-radius: 200px;
transform: rotate(180deg);
}
.ear {
position: absolute;
top: 150px;
left: -50px;
width: 150px;
height: 125px;
border-left: 10px solid #333;
border-bottom: 10px solid #333;
border-radius: 100%;
background-color: var(--face-color);
transform: rotate(35deg);
}
.ear-line {
position: absolute;
bottom: 70px;
width: 50px;
height: 30px;
border-top: var(--border);
border-top-left-radius: 200px;
border-top-right-radius: 200px;
transform: rotate(10deg);
}
.hair-left {
position: absolute;
top: 50px;
left: 10px;
width: 250px;
height: 100px;
border-top-left-radius: 250px;
border-top-right-radius: 250px;
background-color: #333;
transform: rotate(160deg);
}
.hair-right {
position: absolute;
top: 50px;
left: 243px;
width: 80px;
height: 40px;
border-top-left-radius: 80px;
border-top-right-radius: 80px;
background-color: #333;
transform: rotate(30deg);
}
.hair-line {
position: absolute;
bottom: 95px;
left: -10px;
width: 80px;
height: 80px;
border-top: 20px solid #333;
border-top-left-radius: 200px;
border-top-right-radius: 200px;
transform: rotate(70deg);
}
.beanie-container {
position: absolute;
top: -70px;
left: -80px;
width: 339px;
transform: rotate(-15deg);
}
.beanie-container::after {
content: "";
position: absolute;
top: 85px;
left: -20px;
width: 349px;
height: 100px;
border: var(--border);
border-radius: 40px 40px 18px 18px;
background-color: #ff665a;
}
.beanie-left,
.beanie-right {
position: absolute;
width: 170px;
height: 170px;
background-color: #ff665a;
}
.beanie-left {
left: 0;
border-top: var(--border);
border-left: var(--border);
border-top-left-radius: 170px;
}
.beanie-right {
right: 0;
border-top: var(--border);
border-right: var(--border);
border-top-right-radius: 170px;
}