๐ค ๋ฌธ์ ๋งํฌ : GRID GARDEN
CSS ์ฝ๋๋ก ๋น๊ทผ๋ฐญ ๊ฐ๊พธ๊ธฐ
๐ฅ ๋จ๊ณ 1
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column-start: 3;
}
๐ฅ ๋จ๊ณ 2
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#poison {
grid-column-start: 5;
}
๐ฅ ๋จ๊ณ 3
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
/* ์์ง์ ์ ๊ธฐ์ค์ผ๋ก! */
grid-column-start: 1;
grid-column-end: 4;
}
๐ฅ ๋จ๊ณ 4
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
/* ์์ง์ ์ ๊ธฐ์ค์ผ๋ก! */
grid-column-start: 5;
grid-column-end: 2;
}
๐ฅ ๋จ๊ณ 5
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
/* ์์ง์ ์ ๊ธฐ์ค์ผ๋ก ์ค๋ฅธ์ชฝ์ -1 -2 -3... ์ผ๋ก ์ง์ ๋๋ค. */
grid-column-start: 1;
grid-column-end: -2;
}
๐ฅ ๋จ๊ณ 6
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#poison {
grid-column-start:4;
}
๐ฅ ๋จ๊ณ 7
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column-start: 2;
grid-column-end: span 2;
}
๐ฅ ๋จ๊ณ 8
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column-start: 1;
grid-column-end:6;
}
๐ฅ ๋จ๊ณ 9
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column-start: span 3;
grid-column-end: 6;
}
๐ฅ ๋จ๊ณ 10
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column: 4 / 6;
}
๐ฅ ๋จ๊ณ 11
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column: 2/sapn3;
}
๐ฅ ๋จ๊ณ 12
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-row-start: 3;
}
๐ฅ ๋จ๊ณ 13
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-row: 3/6;
}
๐ฅ ๋จ๊ณ 14
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column: 2;
grid-row: 5;
}
๐ฅ ๋จ๊ณ 15
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column: 2/span4;
grid-row: 1/span5;
}
๐ฅ ๋จ๊ณ 15
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column: 2 / span4;
grid-row: 1 / span5;
}
๐ฅ ๋จ๊ณ 16
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-area: 1 / 2 / 4 / 6;
}
๐ฅ ๋จ๊ณ 17
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water-1 {
grid-area: 1 / 4 / 6 / 5;
}
#water-2 {
grid-area: 2 / 3 / 5 / 6;
}
๐ฅ ๋จ๊ณ 18
0
์ผ๋ก ์ธํ
๋์ด ์๋ค.order
๋ ์์ ๊ฐ์์ ํฐ ๊ฐ์ผ๋ก ์ถ๋ ฅํ๊ธฐ ๋๋ฌธ์ ๋
์ order: 1
์ ์ค๋ค.order: 0
์ธ ๋ฌผ์ ์ ๋ถ๋ถ์ ๋ฐฐ์น๋๊ณ order: 1
์ ๊ฐ์ง ๋
์ ๋ฌผ๋ณด๋ค ํฌ๊ธฐ ๋๋ฌธ์ ๋ท ๋ถ๋ถ์ ๋ฐฐ์น๋๋ค.order
์ ์์๊ฐ ์ ํด์ ธ ์๋ค๋ฉด ๋
์ order: 5
๋ก ์ง์ ํด ์ค๋ค.#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
.water {
order: 0;
}
#poison {
order: 1;
}
๐ฅ ๋จ๊ณ 19
#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
.water {
order: 0;
}
.poison {
order: -1;
}
๐ฅ ๋จ๊ณ 20
#garden {
display: grid;
grid-template-columns: 50%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column: 1;
grid-row: 1;
}
๐ฅ ๋จ๊ณ 21
#garden {
display: grid;
grid-template-columns: 12.5%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-column: 1;
grid-row: 1;
}
๐ฅ ๋จ๊ณ 22
์ฐธ๊ณ ์๋ฃ
Tutorial CSS size: rem, em, px
WATCHA ๊ฐ๋ฐ์ง์-px|em|rem
px
, rem
, em
๋ฑ์ ๋จ์๋ฅผ ์ด์ฉํ๋ค.px
: ํฝ์
(pixel, px)์ ํฐํธ์ HTML์์์ ํฌ๊ธฐ๋ฅผ ์ง์ ํ๋ ํ์ค ๋จ์์ด๋ค.rem
: rem
๊ฐ์ HTML ๋ฃจํธ ์์์ font-size
๋ฅผ ๊ธฐ์ค์ผ๋ก ๊ธ๊ผด ํฌ๊ธฐ๋ฅผ ํ์ํ๋ค.em
: ์์์ ๋ถ๋ชจ์ ์ง์ ํ ํฌ๊ธฐ์ ๋ฐ๋ผ ํด๋น ์์์ ํฌ๊ธฐ ๊ฒฐ์ ํ๋ค.#garden {
display: grid;
/* 1์ดํฌ๊ธฐ 2์ดํฌ๊ธฐ 3์ดํฌ๊ธฐ .... */
/* 1ํํฌ๊ธฐ 2ํํฌ๊ธฐ 3ํํฌ๊ธฐ .... */
grid-template-columns: 100px 3em 40%;
grid-template-rows: 20% 20% 20% 20% 20%;
}
๐ฅ ๋จ๊ณ 23
fr
: fraction, ์ซ์ ๋น์จ๋๋ก ํธ๋์ ํฌ๊ธฐ๋ฅผ ๋๋๋ค.#garden {
display: grid;
grid-template-columns: 1fr 5fr;
grid-template-rows: 20% 20% 20% 20% 20%;
}
๐ฅ ๋จ๊ณ 24
50px
๋ก ๊ณ ์ ํ๋ค.1fr
๋ฅผ ์ฌ์ฉํ์ฌ ๋๋จธ์ง ๊ณต๊ฐ์ ์ฐจ์งํ๋ค.#garden {
display: grid;
grid-template-columns: 50px 1fr 1fr 1fr 50px;
grid-template-rows: 20% 20% 20% 20% 20%;
}
#water {
grid-area: 1 / 1 / 6 / 2;
}
#poison {
grid-area: 1 / 5 / 6 / 6;
}
๐ฅ ๋จ๊ณ 25
#garden {
display: grid;
grid-template-columns: 75px 3fr 2fr;
grid-template-rows: 100%;
}
๐ฅ ๋จ๊ณ 26
50px
๋ก ๊ณ ์ 50px
๋นผ๊ณ ์ฑ์ฐ๊ธฐ ์ํด ๋๋จธ์ง ํ์ ๋์ด๋ฅผ 0
์ผ๋ก ์ค์ ํ๋ค.0
์ผ๋ก ์ค์ ํ ํ์ ๊ณต๊ฐ ์ฐจ์ง๋ฅผ ํ์ง ์๊ณ 1fr
์ ์ด์ฉํ์ฌ 50px
์ ์ ์ธํ ๊ณณ์ ์ฑ์ด๋ค.#garden {
display: grid;
grid-template-columns: 20% 20% 20% 20% 20%;
grid-template-rows: 50px 0 0 0 1fr;
}
#water {
/* ๋น ๋
*/
grid-column: 1 / 6;
/* ๋ฌผ์ด ์๋ ํ */
grid-row: 5 / 6;
}
๐ฅ ๋จ๊ณ 27
#garden {
display: grid;
grid-template: 60% 60% / 200px;
}
#water {
grid-column: 1;
grid-row: 1;
}
๐ฅ ๋จ๊ณ 28
50px
์ ์ ์ธํ ๋
์ 1fr
๋ฅผ ์ด์ฉํ์ฌ ๋น์จ์ ์ฑ์ด๋ค.20%
๋ฅผ ๋
์ผ๋ก ์ฑ์ฐ๊ณ ๋๋จธ์ง๋ฅผ 1fr
๋ฅผ ์ด์ฉํ์ฌ ๋น์จ์ ์ฑ์ด๋ค.#garden {
display: grid;
/* ํ / ์ด */
grid-template: 1fr 50px / 20% 1fr;
}
โ 2022.02.26