gpt4 book ai didi

css - 将 css 类转换为 mixin

转载 作者:太空宇宙 更新时间:2023-11-04 03:50:16 25 4
gpt4 key购买 nike

下面是我的CSS代码。

div {
&:before {
position: absolute;
width: 48%;
height: 10px;
content: ' ';
left: 20px;
bottom: 40px;
@include vendor(transform, top);
@include vendor(transform, skew(-5deg) rotate(-3deg));
@include vendor(box-shadow, 0 30px 4px 10px red);
z-index: -1;
}
}

下面是我的mixin。

@mixin prefix($property, $value) {
-webkit-#{$property}: $value;
-moz-#{$property}: $value;
-ms-#{$property}: $value;
-o-#{$property}: $value;
#{$property}: $value;
}

是否可以将整个 before block 代码转换为通用的 mixin,如 add-effect

最佳答案

@mixin add-effect {
&:before {
position: absolute;
width: 48%;
height: 10px;
content: ' ';
left: 20px;
bottom: 40px;
@include vendor(transform, top);
@include vendor(transform, skew(-5deg) rotate(-3deg));
@include vendor(box-shadow, 0 30px 4px 10px red);
z-index: -1;
}
}

关于css - 将 css 类转换为 mixin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23495027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com