[1-1] HTML
[1-2] CSS
νμ΄νΌν
μ€νΈ λ§ν¬μ
μΈμ΄ (HyperText Markup Language)
λ€νΈμν¬κ° μ°κ²°λ μΉνμ΄μ§μμ λ¬Έμλ₯Ό μμ±
νκ³ , μ½κ³
, 곡μ
νκΈ° μν΄μ λ§λ€μ΄μ§ 체κ³λ€.
HTML μΈμ΄μ λ³Έμ§μ, μ¬μ©μκ°μ μν΅
νκΈ° μν μ ν΄μ§ μ½μμ΄λ©°,
νκ·Έλ₯Ό ν΅ν΄ μΉνμ΄μ§μμ 보μ¬μ§ λ΄μ©μ λνλΈλ€.
block
: νμ΄μ§μ κ°λ‘ λμ΄ μ 체λ₯Ό μ°¨μ§νλ μμinline
: μμ μ ν¬κΈ°λ§νΌλ§ μ°¨μ§νλ μμselect
: μ νλ°μ€ νκ·Έol , ui
: λͺ©λ‘ νκ·Έtable
: ν νκ·ΈCSSλ λ¨μν λ¬Έμ ννμΈ HTMLμ μμκ² κΎΈλ©°
μ£Όκ³ κ΅¬μ‘°
λ₯Ό μ‘μμ£Όλ μν μ νλ€.
CSS ꡬ문μ μ νμ(Selector)
, μ μΈ(Declaration)
μ νμ(Selector)
: μ΄λ€ HTML μμλ₯Ό μ νν΄μ μ€νμΌμ μ μ©ν κ²μΈμ§ μ§μ μ μΈ(Declaration)
: ꡬ체μ μΌλ‘ μ΄λ ν μ€νμΌμ μ νμμ μ μ©ν κ²μΈμ§ μ§μ μ μΈμ λ€μ μμ±(property)
, μμ±κ°(property value)
μ ꡬ쑰λ₯Ό κ°μ§κ³ μλ€.
μμ±(Property)
: μ μ©νκ³ μ νλ μ€νμΌμ μ’
λ₯λ₯Ό κ²°μ μμ± κ°(Property value)
: ν΄λΉ μμ±μ μ ννκ² μ΄λ€ κ°μΌλ‘ μ§μ ν κ²μΈμ§ κ²°μ div { background-color : red; }
#id { property : property value; }
.box { border : 2px solid red; }
:κ°μ μ΄λ²€νΈ
λ₯Ό λΆμ΄λ©΄ νΉμ μ΄λ²€νΈλ§λ€ μ μ© ν μ€νμΌμ μ€μ ν μ μμΌλ©°, μ΄λ₯Ό κ°μ ν΄λμ€λΌ νλ€.
:nth-child(n)
: λͺ¨λ νμ μμ μ€ nλ²μ§Έ μμλ₯Ό μ ννλ κ°μ ν΄λμ€ μ νμ:nth-of-type(n)
: νμ μμ μ€ νΉμ νμ μ nλ²μ§Έ μμλ₯Ό μ ννλ κ°μμ νμ:active
: νμ±νλ μμλ₯Ό μ ν νλ κ°μ ν΄λμ€ μ νμ:focus
: focusλ₯Ό λ°κ³ μλ μ λ ₯μ°½λ€μ μμλ₯Ό μ ν νλ κ°μ ν΄λμ€ μ νμ:visited
: μ¬μ©μκ° λ°©λ¬Έν μ μλ λ§ν¬λ₯Ό μ ν νλκ°μ ν΄λμ€ μ νμ
:before
, :after
: htmlμμλ₯Ό μμ νμ§ μκ³ , cssλ§μΌλ‘ κ°μ μμλ₯Ό μΆκ°ν΄ μ νν μ μλ€.λ°μ€λͺ¨λΈμ HTML μμλ₯Ό ν¨λ©(padding)
, ν
λ리(border)
, λ§μ§(margin)
κ·Έλ¦¬κ³ λ΄μ©(content)
μΌλ‘ ꡬλΆνλ€.
content-box
: Content μμμ κΈ°μ€μΌλ‘ boxμ sizeλ₯Ό μ μ©νλ€. (κΈ°λ³Έκ°)border-box
: Border μμμ κΈ°μ€μΌλ‘ boxμ sizeλ₯Ό μ μ©νλ€.μ λ ¬μ λ°©λ²μΌλ‘ κ°μ₯λ§μ΄ μ¬μ©λλ λ°©λ²μΌλ‘λ flex
, position
, grid
κ° μλ€.
2μ°¨μμ
μΈ κ΅¬μ‘° λ₯Ό κ°μ§κ³ μλ€.κΈ°λ³Έμ μΌλ‘ cssλ λΆλͺ¨ μμμ μ§μ ν μμ±κ°μ μμ μμμκ²λ μμν΄μ μ μ©νλ€.
νμ§λ§, λͺ¨λ μμ±μ΄ μμλλ κ²μ μλλ€.
μ¬λ¬κ°μ μμ μμ±μ΄ κ²Ήμ³€λ€κ³ ν λ, Cascading
μ΄λΌλ μ΄λ¦μ κ·μΉμ΄ μ°μ μμλ₯Ό κ²°μ
Cascadingμ κΈ°μ€
λΈλΌμ°μ μ€νμΌ μνΈ
< μ¬μ© μ€νμΌμνΈ
< κ°λ°μ μ€νμΌ μνΈ
λΆλͺ¨μκ² μμλ°μ μμ±
< μ 체 μ νμ
< νκ·Έ μ νμ
< ν΄λμ€ μ νμ
, κ°μ μ νμ
< ID μ νμ
CSSμλ μ¬μ©ν μ μλ λ¨μλ ν¬κ² μ λ λ¨μ
μ μλ λ¨μ
λ‘ λΆλ₯λλ€.
vw
/ vh
μμμ νκΈ°ν μ μλ λ°©λ²μλ 3κ°μ§ λ°©λ²μ΄ μλ€.
color: red
color: #94FB11
rgb(red, green, blue)
calc()
μ΄λΌλ ν¨μλ₯Ό μ΄μ©νλ©΄, κ΄νΈ μμ μ¬μΉμ°μ°μ μνν κ²°κ³Όλ₯Ό μμ±κ°μΌλ‘ μ¬μ©ν μ μλ€.
- λ§μ
.item1{ background: red; width: calc(50px + 50px); height: 50px; }
positionμ΄λ HTML μμκ° λ°°μΉλλ λ°©μμ κ²°μ νλ μμ±
cssμμ μ λλ©μ΄μ
μ μ€ μ μλ λ°©λ²μλ ν¬κ² λκ°μ§κ° μλλ°, κ·Έ λ μ€ ν λ°©λ²μ΄ λ°λ‘ νΈλμ§μ
μ΄λ€.
νΈλμ§μ
μ css μμ±μ μ΄μ©ν λ³νμ μ , ν μ¬μ΄μ μ λλ©μ΄μ
μ μΆκ°ν΄μ μμ§μμ λΆλλ½κ² λ§λ€μ΄ μ€ μ μλ€.
CSS μμμ transform μ λ¨μ΄μ μλ―Έλλ‘ λμμ΄ λλ μμμ μ΄λ
, νμ νλ/μΆμ
, λΉνκΈ°
λ±μ λ³ν ν¨κ³Ό λ₯Ό μ€ μ μλ€.
tansform : rotate(75deg) translateY(120px)
CSS μ λλ©μ΄μ
μ μμ
, μ€κ°
, λ
λ±μ μ€κ° μνλ₯Ό μ μ νλ€.
/* keyframe μμ± λ°©λ² */ @keyframes μ λλ©μ΄μ μ΄λ¦ { from { left : 0; } to{ left : 200px; } }
/* keyframe μμ± λ°©λ² */ @keyframes μ λλ©μ΄μ μ΄λ¦{ 0% { left : 0; } 50%{ left : 200px; } 100%{ top : 200px; left : 200px; } }
κΈ°κΈ°μ Viewport
κ·κ²©μ λ°μνμ¬ λ μ΄μμμ΄ μλμΌλ‘ λ³κ²½λλ μΉνμ΄μ§ λ₯Ό λ»νλ€.
λ―Έλμ΄ μΏΌλ¦¬
λ Viewport
μ λλΉμ λ°λΌ μΉμ¬μ΄νΈμ μ€νμΌ μνΈλ₯Ό μμ ν μ μκ² ν΄μ£Όλ CSSμ κΈ°λ₯
//λ―Έλμ΄ μΏΌλ¦¬μ κΈ°λ³Έ νν// @media screen and (max-width: 500px) { /* μ€ν¬λ¦°μ λλΉκ° 500px μ΄νμΌ κ²½μ° μ μ©μν¬ μ€νμΌ μνΈλ₯Ό μ μ΅λλ€. */ }
Viewport
: μΉ λΈλΌμ°μ λ₯Ό ν΅ν΄ μΉνμ΄μ§μ μ μνμ λ, μ£Όμμ°½μ΄λ ν λ±μ μ μΈνκ³ μ€μ μΉνμ΄μ§μ 컨ν
μΈ κ° μ°¨μ§νλ μμbreakPoint
: λ°μν μΉνμ΄μ§μ μμ
κΈ°μ€μ΄ λλ μ€λ¨μ μ μλ―Έ!DOCTYPE html> <html lang="en"> <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>Final</title> <link rel="stylesheet" href="./index.css"> <script src="./index.js"></script> </head> <body> <div class="main"> <div class="wrapper"> <div class="header"> <h1>μ½λμΊ ν Base.Camp</h1> </div> <div class="body"> <div class="d-day"> <div class="d-day-title"> <h2>D-Day</h2> </div> <div id="d-day-container"> <div class="d-day-child-container"> <span id="days">0</span> <span>μΌ</span> </div> <div class="d-day-child-container"> <span id="hours">0</span> <span>μκ°</span> </div> <div class="d-day-child-container"> <span id="min">0</span> <span>λΆ</span> </div> <div class="d-day-child-container"> <span id="sec">0</span> <span>μ΄</span> </div> </div> <div id="d-day-message"></div> <div id="target-selector id"> <input type="text" maxlength="4" id="target-year-input" oninput="changeFocus1()" class="target-input" size="5" /> - <input type="text" maxlength="2" id="target-month-input" oninput="changeFocus2()" class="target-input" size="5" /> - <input type="text" maxlength="2" id="target-date-input" class="target-input" size="5" /> </div> <button onclick="starter()" class="btn">μΉ΄μ΄νΈλ€μ΄ μμ</button> <button onclick="resetTimer()" class="btn">νμ΄λ¨Έ μ΄κΈ°ν</button> </div> <div class="todo"> <div id="toto-title"> <h2>ToDo-List</h2> </div> <div class="todo-container"> <input type="text" id="todo-input" onkeydown="keyCodeCheck()" /> <ul id="todo-list"> </ul> </div> <div class="delete-btn-warper"> <button onclick="deleteAll()" id="list-btn">리μ€νΈ μμ </button> </div> </div> </div> <button class="last-btn">μ 체 μ΄κΈ°ν</button> </div> </div> </body>
* {
box-sizing: border-box;
margin: 0px;
}
html,
body {
width: 100%;
height: 100%;
}
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #F9FAFB;
}
.main {
width: 500px;
height: 700px;
border: 1px solid #AACDFF;
box-shadow: 7px 7px 39px rgba(0, 104, 255, 0.25);
border-radius: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.wrapper {
width: 400px;
height: 600px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
.header {
color: #0068FF;
border-radius: 5px;
background-color: #E6F2FF;
width: 100%;
padding-left: 15px;
display: flex;
flex-direction: row;
align-items: center;
}
.body {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
}
.d-day {
width: 100%;
height: 250px;
padding-bottom: 10px;
background: rgb(255, 255, 255);
box-shadow: rgb(63 71 77 / 15%) 0px 2px 6px;
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
}
.d-day-title {
height: 40px;
color: #0068FF;
border-radius: 3px;
padding-bottom: 3px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#d-day-container {
display: flex;
}
.d-day-child-container {
color: #0068FF;
}
.target-input {
height: 22px;
border: 1px solid #bbbbbb;
border-radius: 3px;
background-color: #F9FAFB;
}
.target-input:focus {
outline: none;
border: 1px solid #0068FF;
}
.btn {
width: 140px;
height: 26px;
color: #0068FF;
background: #FFFFFF;
border: 1px solid #0068FF;
border-radius: 4px;
cursor: pointer;
transition: width ease-in-out 0.2s;
}
.btn:hover {
width: 170px;
font-weight: 500;
color: #FFFFFF;
background: #0068FF;
}
.todo {
width: 100%;
height: 190px;
background: rgb(255, 255, 255);
box-shadow: rgb(63 71 77 / 15%) 0px 2px 6px;
border-radius: 10px;
margin: 15px 0px;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
}
#toto-title {
height: 40px;
color: #0068FF;
border-radius: 3px;
padding-bottom: 3px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 6px;
}
#todo-input {
margin-bottom: 60px;
height: 22px;
border: 1px solid #bbbbbb;
border-radius: 3px;
background-color: #F9FAFB;
}
#todo-input:focus {
outline: none;
border: 1px solid #0068FF;
}
#list-btn {
margin-bottom: 10px;
width: 140px;
height: 26px;
color: #0068FF;
background: #FFFFFF;
border: 1px solid #0068FF;
border-radius: 4px;
cursor: pointer;
transition: width ease-in-out 0.2s;
}
#list-btn:hover {
width: 170px;
font-weight: 500;
color: #FFFFFF;
background: #0068FF;
}
.last-btn {
width: 100%;
height: 60px;
color: #FFFFFF;
background: #0068FF;
border: none;
border-radius: 4px;
cursor: pointer;
}
.last-btn:hover {
font-weight: 500;
color: #FFFFFF;
background: #0050c7;
}