주의: mask-image는 ie 브라우저 미지원!!!
mixins.scss
// mixin
@mixin svg($path, $width, $height, $color) {
width: $width;
height: $height;
background-color: $color;
-webkit-mask-image: url($path);
mask-image: url($path);
background-size: cover;
-webkit-background-size: cover;
mask-size: contain;
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
}
사용하기 (@include)
// 노랑색 배경의 검정 로고
.logo {
width: 92px;
height: 92px;
background: #ffe31d;
span {
@include svg('~@/assets/images/logo.svg', 78%, 21px, #000);
}
}
호환성
반응형
'UXUI Development > CSS Pre-Processor' 카테고리의 다른 글
SASS(scss) 문법 #3 _ @mixin 믹스인, @include (0) | 2021.12.13 |
---|---|
SASS(scss) 문법 #2_ Variables (변수) (0) | 2021.12.13 |
SASS(scss) 문법 #1_ Nesting(중첩) (0) | 2021.12.13 |
CSS Pre-Processor 전처리기 (0) | 2021.12.13 |
CSS-in-CSS (0) | 2020.07.08 |