作者:大女人小诺 | 来源:互联网 | 2023-05-19 18:59
Slightlyrelatedtomyquestionhere.这和我的问题有点关系。SayinSass,ifIwishtousemultiplevaluesfo
Slightly related to my question here.
这和我的问题有点关系。
Say in Sass, if I wish to use multiple values for one property, is there a way that I can achieve this using a mixin?
在Sass中,如果我想要为一个属性使用多个值,是否有一种方法可以使用mixin实现它?
NB: I know that my usage of @each
is wrong but this helps to illustrate what I'm trying to do.
NB:我知道我使用@each是错误的,但这有助于说明我正在尝试做什么。
So far I have the following
到目前为止,我有如下内容。
@mixin grid-fractions($grid-type, $args) {
@supports (display:grid) {
display: grid;
#{$grid-type}: @each $args #{$args}fr;
}
}
It's usage is as follows: @include('grid-template-rows', 2, 1, 1);
And I'd like to get the mixin to output something like this:
它的用法如下:@include('grid-template-rows', 2,1,1);我想让mixin输出这样的东西:
@supports (display:grid) {
display: grid;
grid-template-rows: 2fr 1fr 1fr;
}
I know that $args
lets you include multiple values in a mixin but it's obviously not working as I'm probably not using it correctly!
我知道$args让您在mixin中包含多个值,但它显然不能正常工作,因为我可能没有正确地使用它!
1 个解决方案