gpt4 book ai didi

css - SASS/SCSS 对象键值循环

转载 作者:技术小花猫 更新时间:2023-10-29 10:19:21 33 4
gpt4 key购买 nike

<分区>

看看这个例子:

@include font-face('Entypo', font-files('entypo.woff'));

.icon {
display: inline;
font: 400 40px/40px Entypo;
}

.icon-star {
@extend .icon;

&:after {
content: "\2605";
}
}

.icon-lightning {
@extend .icon;

&:after {
content: "\26A1";
}
}

我想让事情尽可能干燥,所以我想知道以下是否可行,如果可行,如何实现?

@include font-face('Entypo', font-files('entypo.woff'));

.icon {
display: inline;
font: 400 40px/40px Entypo;
}

$icons {
$star: "\2605";
$lightning: "\26A1";
}

@each $icon in $icons {
$key = $icon{key}; // ???
$value = $icon{value}; // ???

.icon-#{$key} {
@extend .icon;

&:after {
content: $value;
}
}
}

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