CSS-2
CSS-2
~์น์ ์ธ์ด๋ค๋ก ๊ตฌ์ฑ๋์ด ์๋ค. ๊ฐ์ฅ ํฌ๊ฒ 3๊ฐ์ง๋ก ๋๋๋ฉด, HTML, CSS, JavaScript๊ฐ ์๋ค.
HTML: ๋ผ๋, CSS: ๊ทผ์ก, JavaScript: ๋
CSS : Cascading Style Sheet, ์์๋๋ก ๋ ์คํ์ผ ์ํธ์ด๋ค.
ํ๊ทธ๋ฅผ ์ค๋ณตํด์ ๋ง๋ค์๋ค๋ฉด ์ฝ๋์ ๊ฐ์ฅ ๋ง์ง๋ง ๋ถ๋ถ์ด ์คํ์ผ๋ก ์ ์ฉ๋๋ค.
์ธ์ธ ํ์์๋ค. ๋ชจ๋ฅด๋ ์ ํ์ด ๋์ค๋ฉด Google, MDN์ ์ฐพ์๋ณด์.
Do not memorize !
Transition - 1
- transition : state๊ฐ ์๋ root์ ์์ด์ผ ํ๋ค.
๋ณํํ๋ ๋ชจ์ต์ ์ฌ์ฉํ๋ ค๋ฉด state์๋ ๋ณํ ํน์ฑ์ด ์์ด์ผ ํ๋ค. - ease-in-out์ ์ด์ฉํด์ ์ ๋๋ฉ์ด์ ์ ์ค ์ ์๋ค.
<style>
div {
width: 50px;
height: 50px;
background-color: teal;
transition: all 1s ease-in-out;
}
div:hover {
transform: rotateX(45deg);
}
</style>
Transition - 2
- ๋ณํํ๋ ์ ๋๋ฉ์ด์ ์ ์๋๋ฅผ ์ ํด์ฃผ๋ ease function์ด ์๋ค. goole go !
-
- ๋ํดํธ๋ฅผ ๊ฐ๊ณ ์๋ ease-in function
- linear / ease-in / ease-out / ease-in-out
- ๋ํดํธ๋ฅผ ๊ฐ๊ณ ์๋ ease-in function
- all์ ์ด์ฉํด ๋ชจ๋ ํน์ฑ์ ๋ณํ์ํฌ ์ ์๋ค.
ํน์ ํน์ฑ์ ์ ํด์ ๋ณํ์ํฌ ์ ์๋ค.
<style>
a {
color: white;
background-color: tomato;
text-decoration: none;
padding: 3px 5px;
border-radius: 5px;
font-size: 50px;
transition: all 1s ease-in-out;
transition: background-color 1s ease-in-out, font-size 1s ease-in;
}
a:hover {
font-size: 30px;
color: teal;
background-color: green;
font-size: 70px;
}
Transformation
- block์ด๋ ๋ค๋ฅธ element์ ์ํฅ์ ์์ฃผ๊ณ 3d๋ก ์์ง์ด๊ฒ ํ๋ ์ญํ ์ด๋ค.
- ๋ค๋ฅธ ํ์ด์ง์ ์ฐจ์์์ ์ผ์ด๋๊ฒ ๋ณํ๋ฅผ ์ค๋ค.
๋ค๋ฅธ ๋ฐ์ค์ ์ํฅ์ ์ฃผ์ง ์๋๋ค. - ๋ค์ํ ์์ฑ๋ค์ MDN ์ฐธ๊ณ ํ์.
<style>
img {
width: 10cm;
height: 10cm;
border: 10px solid black;
border-radius: 50%;
transition: all 1s ease-in-out;
}
img:hover {
transform: rotateY(360deg);
}
</style>
Animations - 1
- @keyframes name
<style>
@keyframes coinFlip {
from {
transform: rotateY(0deg);
}
to {
transform: rotateY(360deg);
}
}
img {
width: 10cm;
height: 10cm;
border: 10px solid black;
border-radius: 50%;
animation: coinFlip 5s ease-in-out infinite;
}
</style>
Animations - 2
-
% ๋ฅผ ๋ฃ์ด์ ์ ๋๋ฉ์ด์ ์ ์ฐ์์ฑ ๋ถ์ฌํ๊ธฐ
Pading and IDs
- Padding์ ๊ฒฝ๊ณ์ ์์ชฝ ๊ณต๊ฐ์ด๋ค. Padding์ margin์ ์ค๋ค๋ฉด border๋ถ๋ถ์ด ๊ฒน์น์ง ์๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ๊ฐ ํ๊ทธ์ id๋ฅผ ์ฃผ๊ณ div์์ div๋ฅผ ๋ฐฐ์นํด๋ฌ ๊ฐ ๊ฒฝ๊ณ์ ์์์ ๋ค๋ฅด๊ฒ ์ฃผ์๋ค. ๊ทธ๋ฆฌ๊ณ padding margin์ ์ฃผ๋ฉด์ ์๋ก ๋ค๋ฅธ box์ธ ๊ฒ์ ๋ณด์ฌ์ค๋ค.
<style>
@keyframes coinFlip {
0% {
transform: rotateY(0deg) translateX(-1000px);
}
25% {
transform: translateX(-500px) translateY(500px);
}
50% {
transform: rotateY(360deg) translateX(0px) translateY(1000px);
}
75% {
transform: translateX(500px) translateY(500px);
}
100% {
transform: rotateY(0deg) translateX(1000px);
}
}
Media Query & Media Queries recap
- screen์ ์ฌ์ด์ฆ์ ๋ฐ๋ผ ๋ณํ๋ฅผ ์ฃผ๋ ๋ฒ
- screen์ ํฌ๋กฌ ๋ด์ ํธ๋ํฐ ๋ชจ๋๋ก ํ ์ ์๋ ๊ฒ์ด ๋ด๊ฒจ์๋ค.
- screen and ~~~ and ~~~ and { ๋ด๋ถ์๋ element๊ฐ ๋ค์ด๊ฐ์ผ ํ๋ค. }
- screen ๋ฟ๋ง ์๋๋ผ print ๋ฑ,, ๋ค์ํ ๊ธฐ๋ฅ์ด ์๋ค. check the MDN
<style>
@media screen and (min-width: 400px) and (max-width: 700px) and (orientation: landscape) {
div {
background-color: tomato;
}
.good {
color: black;
}
span {
display: none;
}
}
</style>