ํฐ์คํ ๋ฆฌ ๋ทฐ
๋ฆฌํฉํ ๋งํด์ผ ๋ ์ฌํญ
๋ค์๊ณผ ๊ฐ์ด ๋์ผํ Feed Style ์์ฑ ๊ฐ์ ์ง๋๊ณ ์์ง๋ง ์์ ๋ค์ด๊ฐ๋ ์ด๋ฏธ์ง์ Layout๋ง์ด ๋ค๋ฅธ ๋ UI ์์๊ฐ ์๋ค.
์ ์์ Feed์๋ ๋จ์ผ ์ด๋ฏธ์ง๋ง์ด ๋ค์ด๊ฐ๋ ๋ฐ๋ฉด์ ํ์์ Feed์๋ Grid Layout ํ์์ผ๋ก ์ด 4์ฅ์ ์ด๋ฏธ์ง๊ฐ ๋ค์ด๊ฐ๋ค.
๋ค์ด๊ฐ๋ ์ด๋ฏธ์ง์ ๊ฐฏ์๊ฐ ๋ค๋ฅด๊ธฐ ๋๋ฌธ์ ์ด๋ฏธ์ง์ ํฌ๊ธฐ์ ๋๋ถ์ด ์ธ๋ถ ์์ฑ ๊ฐ์ ๋ฌ๋ฆฌ ํด์ฃผ์ด์ผ ๋๊ธฐ ๋๋ฌธ์ ์ฒ์์๋ ์๋์ ๊ฐ์ด
๊ฐ Feed ์์ฑ ๊ฐ์ Style ๊ฐ์ ์ฃผ์๋ค.
.moviePosterQuarter { // Grid ํ์์ Feed
width: 95%;
height: 95%;
border-radius: 4px;
background-size: cover;
background-position: center;
}
( ... )
.moviePoster { // ๋จ์ผ ํ์์ Feed
width: 100%;
height: 84%;
border-radius: 4px;
background-size: cover;
background-position: center;
}
์ด๋ ๊ฒ Style ๊ฐ์ ์ค์ ํด ์ค ๋ค์ ์๊ฐํด๋ณด๋, ๋ Feed ๋ด ์ด๋ฏธ์ง ์์ฑ ๊ฐ์์ ๋ฌ๋ผ์ง๋ ๊ฑด width ๊ฐ๊ณผ height ๊ฐ ๋ฟ์ด๋ผ๋๊ฑธ ๊นจ๋ฌ์๋ค.
์ง๊ธ์ ๊ทธ ๋์์ด ๋ ๊ฐ์ ์์๊ฐ ์์ฑ ๋ฟ์ด์ง๋ง ํ๋ก์ ํธ ๋ด์์ ์ด๋ฐ ๊ฒฝ์ฐ๊ฐ ๋ง์์ง๋ฉด ์ฝ๋๊ฐ ๋นํจ์จ์ ์ด๊ฒ ๋ ๊ฑฐ๋ผ๋ ์๊ฐ์ ๋ฆฌํฉํ ๋ง์ ํด๋ณด๊ธฐ๋ก ํ๋ค.
๋ฌธ์ ๋ ์ด ๋ ๊ฐ๋ง์ ๋์ ์ผ๋ก ๋ณํ๊ฒ ํด์ฃผ๊ณ ๋ค๋ฅธ ์์ฑ์ ๊ณตํต ๋ถ๋ชจ๋ก ์ด๋ป๊ฒ ๋ฌถ์ด์ค ์ ์๋๊ฐ? ์๋๋ฐ ์ด์ ๋ํ ํด๋ต์ ๊ทธ๋ฆฌ ์ด๋ ต์ง ์์๋ค.
SCSS MIXIN
https://sass-lang.com/documentation/at-rules/mixin
They can be used to encapsulate styles that can be dropped into a single style rule; they can contain style rules of their own that can be nested in other rules or included at the top level of the stylesheet; or they can just serve to modify variables.
SCSS MIXIN ์์ฑ์ ์ฌ์ฉํ์ฌ ์ฝ๋ ๋ด์์ ๊ณตํต์ผ๋ก ์ฐ์ด๋ Style ์์ฑ์ ์ ์ํ๊ณ Include ๊ตฌ๋ฌธ์ ์ฌ์ฉํ์ฌ ํด๋น ๊ฐ์ ๋ถ๋ฌ์์ ์ฐ๊ธฐ๋ก ํ์๋ค.
๋์ ์ผ๋ก ๋ณํ๋ width๊ฐ๊ณผ height๊ฐ์ ์ธ์๋ก ์ค์ ํด์ค ๋ค์
@mixin moviePosterMix($width: 0, $height: 0) {
width: $width;
height: $height;
border-radius: 4px;
background-size: cover;
background-position: center;
}
ํด๋น ํจ์๋ฅผ Include ๊ตฌ๋ฌธ์ ํตํด ์ธ์๊ฐ์ ๋ฃ์ด ํธ์ถํ๋๋ก ์ฝ๋๋ฅผ ๋ฐ๊พธ์๋๋ ์ข ๋ ๋ช ํํด์ง๊ณ ๊ฐ๊ฒฐํด ์ก๋ค.
.moviePosterQuarter {
@include moviePosterMix(95%, 95%);
}
(...)
.moviePoster {
@include moviePosterMix(100%, 84%);
}
'HTML CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์น ๋ ๋๋ง ๊ณผ์ _operation(layout, paint, composition)์ ๊ดํด (2) | 2021.10.11 |
---|---|
position ์์ฑ - relative, absolute, fixed (0) | 2021.10.06 |
float ์์ฑ์ ์ด์ฉํ์ฌ header-menu ์์น ์กฐ์ (0) | 2021.10.06 |
Semantic-Web๊ณผ SemanticTags์ ์ฐจ์ด (0) | 2021.10.05 |
์ด๋ฒคํธ ์ ์ด(pointer-events) ์์ฑ์ ํตํด ํ์ ์ฐฝ ๋นํ์ฑํ (0) | 2021.07.19 |