Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- ์ ๊ฐ์ฐ์ฐ์
- TAG
- ํฉ๊ณ ์๊ณ ๋ฆฌ์ฆ
- carousel slider
- VSCODE๋จ์ถํค
- scss
- Em
- layout
- ::before
- SASS
- ์ธ๋ผ์ธ
- ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ฉํ ์คํธ
- object
- @mixin
- ์๊ณ ๋ฆฌ์ฆ
- js
- ์๋ฐ์คํฌ๋ฆฝํธ
- input
- HTML
- javascript
- float
- string
- html ํ๊ทธ
- ์ธ๋ผ์ธ๋ธ๋ก
- ๋ฌธ์์ด
- inline
- ํ๋ก๊ทธ๋๋จธ์ค
- css
- vscode
- ์ฝ๋ฉํ ์คํธ
Archives
- Today
- Total
Outputor
SASS ๋ฌธ๋ฒ - @mixin, @use์ ์ธ๋๋ฐ( _ ) ๋ณธ๋ฌธ
๐จ CSS ๐ป/๐ฆ SASS-Note
SASS ๋ฌธ๋ฒ - @mixin, @use์ ์ธ๋๋ฐ( _ )
output7 2022. 1. 14. 12:46@mixin
1. ์คํ์ผ ์ฌ๋ฌ์ค์ ํ ๋จ์ด๋ก ์นํํด์ ์ฌ์ฉ๊ฐ๋ฅํจ
2. ํํ: @mixin ์ด๋ฆ ( ){ ์คํ์ผ }
3. @mixin์ ์ฌ์ฉํ๋ ค๋ฉด @include ์ด๋ฆ( )์ ์์ฑํด์ฃผ๋ฉด ๋จ
4. @mixin ์ด๋ฆ ( $bgColor ) { background-color: $bgColor } ์ด๋ ๊ฒ ํจ์์ฒ๋ผ ์ฌ์ฉ๊ฐ๋ฅํจ
@mixin box-style ($bgColor) {
width: 150px;
height: 100px;
margin:auto;
margin-top: 20px;
background-color: $bgColor;
}
.box {
@include box-style(blue);
}
5. @mixin ์ด๋ฆ ( $bg ) { #{bg}: blue } ์ฒ๋ผ ์คํ์ผ ์ด๋ฆ์๋ ์ฌ์ฉ๊ฐ๋ฅํจ
@mixin box-style ($bg) {
width: 150px;
height: 100px;
margin:auto;
margin-top: 20px;
#{$bg}: greenyellow;
}
.box {
@include box-style(background-color);
}
@use์ ์ธ๋๋ฐ( _ )
1. @use 'ํ์ผ์ด๋ฆ' ์ผ๋ก ๋ณต์ฌํ ์ ์์
2. ์ธ๋๋ฐ( _ )๋ฅผ ํ์ผ๋ช ๋งจ ์์ ์ฌ์ฉํ๋ฉด CSSํ์ผ๋ก ์ปดํ์ผํ์ง ์์
@use๋ก ์ฒจ๋ถํ ํ์ผ์ ์๋ ๋ณ์๋ช , @mixin์ ์ฌ์ฉํ ๊ฒฝ์ฐ
1. ํ์ผ์ด๋ฆ.$๋ณ์๋ช
2. @include ํ์ผ์ด๋ฆ.mixin ์ด๋ฆ( )
3. ํ์ผ๋ช ์์ ์ธ๋๋ฐ( _ )๊ฐ ์๋๊ฒฝ์ฐ ์ธ๋๋ฐ๋ ๋นผ๊ณ ํ์ผ๋ช ๋ง ์ ๋ ฅํ๋ฉด ๋จ
/* _reset.scss */
body {
margin:0;
}
div {
box-sizing: border-box;
}
$bg-color: #f06595;
@mixin box-style ($bgColor) {
width: 150px;
height: 100px;
margin:auto;
margin-top: 20px;
background-color: $bgColor;
}
/* test.scss */
@use '_reset';
body {
width: 100%;
background-color: reset.$bg-color;
text-align: center;
}
.box {
@include reset.box-style(greenyellow);
}
'๐จ CSS ๐ป > ๐ฆ SASS-Note' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
SASS ๋ฌธ๋ฒ - SASS์ SCSS, Nesting, @extend (0) | 2022.01.14 |
---|---|
Sass ๋ฌธ๋ฒ - ๋ณ์, ์ฌ์น์ฐ์ฐ (0) | 2022.01.13 |
SASS ๊ฐ๋ฐํ๊ฒฝ ์ธํ (0) | 2022.01.13 |