Intro ๋ถ๋ถ
1) head ๋ํดํธ๊ฐ ์ค์
meta
๊ฐ๊ฐ ์ ์๋ด๋ฆฌ๊ธฐtitle
ํ์ดํ ์ ํ๊ธฐlink
css ๋ถ๋ฌ์ค๊ธฐ<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="์ฐ๋ฆฌ์ ์ ํ ๋ก ๋ง๋ ํค์ฆ๊ฐ์ค ์น์ฌ์ดํธ ์๊ฐ">
<meta name="keywords" content="ํค์ฆ๊ฐ์ค, ์ ํ , ์ฅ๋๊ฐ">
<meta name="author" content="ํค์ฆ๊ฐ์ค">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ํค์ฆ๊ฐ์ค</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/animation.css">
<link rel="stylesheet" type="text/css" href="css/mobile.css">
</head>
2) ์ฒซ ํ์ด์ง ๊ณต๊ฐ ์์
div
๊ณต๊ฐ ๋๋๊ธฐclass
๊ฐ div๋ง๋ค ์ด๋ฆ ์ ํ๊ธฐ <header id="intro">
<div class="introWrap">
<div class="logo"></div>
<div class="lion"></div>
<div class="rabbit"></div>
<div class="bear"></div>
<div class="monkey"></div>
</div>
<div class="cloudWrap">
<div class="leftCloud"></div>
<div class="rightCloud"></div>
<div class="dragonfly"></div>
</div>
</header>
3) css ์ด๊ธฐํ ์์ ๋ฐ ์ ์ฒด์ ์ธ ์ค๊ณ
h
button
clear
๋ฑ ์์ผ๋ก ์ฌ์ฉํ ํ๊ทธ ๋ฏธ๋ฆฌ ์ค๊ณ body { overflow-x: hidden; }
์ฌ์ฉํ์ฌ ๊ฐ๋ก์คํฌ๋กค ๋ฐฉ์ง **7) ์ฐธ๊ณ /* Default CSS */
html, body { margin: 0; padding: 0; }
body { overflow-x: hidden; }
h1, h2, h3, h4, h5, h6, p { margin: 0; padding: 0; }
button { border: none;
/* ๋ฐฐ๊ฒฝ ํฌ๋ช
*/
background-color: transparent }
.clearfix { clear: both; }
4) Intro ์์ญ ๋์์ธ ์์
intro
๋ฐฐ๊ฒฝ ๋ถ๋ฌ์ค๊ธฐ#intro { width: 100%; height: 1600px;
background-image: url(../img/intro_bg.png); }
introWrap
ํฌ์ง์
์ค์ , ๊ฐ์ด๋ฐ ์ ๋ ฌ#intro .introWrap { position: relative;
width: 760px; height: 516px; background-color: yellow;
/* ์ค๋ธ์ ํธ ๊ฐ์ด๋ฐ ์ ๋ ฌ */
left: 50%; margin-left: -380px; }
logo
๋ก๊ณ ๋ฃ๊ธฐ#intro .introWrap .logo { position: absolute;
width: 760px; height: 516px;
background-image: url(../img/intro/logo.png);
/* ๊ธฐ์ค์ ํ์ */ z-index: 100; }
5) ๋๋ฌผ & ๊ตฌ๋ฆ ๋ฐฐ์น์์
z-index
๊ฐ์ ์ฃผ์ด ์ด๋ฏธ์ง ๋ ์ด์ด ์์
margin
์ฌ๋ฐฑ ์กฐ์ #intro .introWrap .lion { position: absolute;
width: 161px; height: 161px;
background-image: url(../img/intro/lion.png);
margin: 80px 0 0 30px; }
#intro .introWrap .rabbit { position: absolute;
width: 105px; height: 129px;
background-image: url(../img/intro/rabbit.png);
margin: 90px 0 0 580px; }
#intro .introWrap .monkey { position: absolute;
width: 85px; height: 93px;
background-image: url(../img/intro/monkey.png);
margin: 310px 0 0 50px;
z-index: 200; }
div
ํ๊ทธ๋ y์ถ์ผ๋ก ์ ๋ ฌ๋๋ฏ๋ก ๋ค์ ์ ๋ ฌfloat
ํ๊ทธ๋ฅผ ์ด์ฉํด ์ ๋ ฌํ๋ฉด ๋์ง๋ง, ๋ ์ด์์ ํ์ด์ง ํ์์ด ์ผ์ด๋๋ค.position: absolute;
์ฌ์ฉํ์ฌ left, right ๊ฐ ์ฃผ๋ฉด๋๋ค.#intro .cloudWrap { position: relative; width: 100%; height: 1050px; background-color: pink; }
#intro .cloudWrap .leftCloud { position: absolute; width: 934px; height: 816px;
background-image: url(../img/intro/cloud1.png);
left: 0;
/* ์ผ์ชฝ ๊ตฌ๋ฆ ์์ชฝ์ผ๋ก ๋ ์ฌ๋ฆฌ๊ธฐ */ z-index: 2; }
#intro .cloudWrap .rightCloud { position: absolute; width: 843px; height: 858px;
background-image: url(../img/intro/cloud2.png);
right: 0; }
6) ๋ก๊ณ ์๋๋ก ๋ด๋ฆฌ๊ธฐ
margin-top: 100px;*
๐ ๋ง์ง๋ณํฉ ํ์์ผ๋ก ์ฌ์ฉXintro
์ introWrap
์ฌ์ด์ ๊ณต๋ฐฑ ๋ง๋ค๊ธฐ (์ฌ์ฉX)intro
์ ๋์ด๊ฐ์ด ๋ณํ๋ค.padding
๊ฐ ๋งํผ ๋ฐ๋ฆฐ๋ค. (๋ ์ด์ด ํ์ด์ง)top
์ ์ฌ์ฉํ๋ค. ( position: relative;
์ฌ์ฉํ ์ด์ )7) ์ ๋๋ฉ์ด์ ๊ตฌํ
#intro .introWrap .lion { animation: spinLion 1500ms linear infinite alternate; }
@keyframes spinLion { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }
keyframes
์์ ์ ์ฉ๋๋ ํจ๊ณผ๋ค์ ๊ธฐ๋ณธ์ ์ผ๋ก ์์ฑ๋ css์ ์ํฅ์ ๋ฐ๋๋ค. (left ์ฌ์ฉ๊ฐ๋ฅ)left
๊ฐ์ 100%๋ก ์ฃผ์ด ์ ์๋ฆฌ๊ฐ ํญ์ ํ๋ฉด ๋ฐ๊นฅ์์ ์ฌ๋ผ์ง๊ฒ ํ๋ ๊ฒ์ด ํฌ์ธํธ !overflow-x
๋ฅผ ์ ์ฉํด์ฃผ์๋ค.#intro .cloudWrap .dragonfly { animation: flyDragonfly linear 7s infinite; }
@keyframes flyDragonfly { from {left: -366px} to {left: 100%} }
8) ๋ชจ๋ฐ์ผ ์ค๊ณ
@media
๋ฏธ๋์ด์ฟผ๋ฆฌ ์์ ํ๊ทธ ์์ฑdisplay: none;
์ผ๋ก PC๋ฒ์ ์ ๋จ์์๋ ์ ๋ณด ๊ฐ์ถฐ์ฃผ๊ธฐ #intro .introWrap .lion,
#intro .introWrap .rabbit,
#intro .introWrap .bear,
#intro .introWrap .monkey,
#intro .cloudWrap .dragonfly { display: none; }
๋๋ถ ๋ถ๋ถ
text-align: center;
๊ธ์, ์ธ๋ผ์ธ ์์์๋ง ์ฌ์ฉ ๊ฐ๋ฅ #farm1 .farmSpeechWrap {
width: 300px;
text-align: center;
left: 50%;
margin-left: -150px;
}
#farm1 .farmSpeechWrap img {
width: 79px;
}
๋จธ์ ๋ถ๋ถ
z-index: 900;
์ผ๋ก ์ค์ ๊ธฐ์ตํด์ผํ ๋ถ๋ถ
overflow-x: hidden;
๋ธ๋ผ์ฐ์ ํฌ๊ธฐ๋ณด๋ค (x์ถ์ ๋ฒ์ด๋๊ฒ ๋๋ฉด) ์จ๊น์ฒ๋ฆฌ
.clearfix { clear: both; }
float๊ณผ ํจ๊ป ๋ฑ์ฅํ๋ clear ํ๊ทธ
( clear both๋ฅผ ๋ด๊ณ ์๋ ๊ด๋ก์ ์ธ ํด๋์ค ๋ช
.clearfix )
position
ํฌ์ง์
์ ์ฌ์ฉํ ๋, ์ด๋ค ์์ฑ๊ฐ์ ์ฌ์ฉํ๋ ๊ฒ์ ๋ฐ๋ผ ๋น์์ฑ์ด ํ์ !
โจ ์ ์ด ์์ฑ๊ฐ์ ์ฌ์ฉํ๋์ง์ ๋ํ ์ด์ ํ์
์ด์ ๋ฅผ ๋ง๋ค์ด๊ฐ๋ฉด ํฌ์ง์
์ดํดํ๋๋ฐ ๋ง์ ๋์์ด ๋๋ค !
position: absolut;
๋ฅผ ์์์ผ๋ก ์ฌ์ฉํ๊ฒ๋๋ฉด, position: relative;
๋ก ๋ถ๋ชจ๋ฅผ ๊ฐ์ธ์ฃผ๊ธฐ = ์ข์ ์ต๊ดposition: absolut;
position: relative;
left: 50%;
margin-left: -380px;
์ค๋ธ์ ํธ ๊ฐ์ด๋ฐ ์ ๋ ฌ
z-index: 100;
100์ด๋ผ๋ ์ซ์๋ณด๋ค ์์ผ๋ฉด ๋ค์ ๋ฐฐ์น, ํฌ๋ฉด ์์ ๋ฐฐ์น๋๋ค. (๊ธฐ์ค์ ํ์)
position: absolute;
์ ํจ๊ป ์ฌ์ฉ
๊ธฐ๋ณธ๊ฐ์ z-index: 0;
์ผ๋ก ์๋ต ๊ฐ๋ฅ
width
๊ฐ์ ๋ฐ๋ผ margin-left
๊ฐ ์ ์ํ๊ธฐ
background repeat
๋ฅผ ํ์ฉํ์ฌ ๋ถํ์ํ ์ด๋ฏธ์ง ์ค์ด๊ธฐ ์คํ, ๋ณ์๋ช
์๋ชป ๊ธฐ์
๋ฑ ๋ค์ํ ์ค๋ฅ๊ฐ ์ผ์ด๋์ ํ์ต์ด ๊ธธ์ด์ก๋ค.
์ค๋๊ฑธ๋ฆฐ๋งํผ ์ป๋ ๊ฒ์ด ๋ง๋ค๊ณ ์๊ฐํ๊ธฐ๋ก ํ๋ค..!
ํ์คํ ํํ์ด์ง ํ๋๋ฅผ ์ก๊ณ ์ฐ์ตํ๋๊ฒ ํจ์ฌ ๋ ์ค๋ฌด์ ๊ฐ๊น์์ง ๋๋์ด ๋ ๋น ๐