gpt4 book ai didi

css - 在另一个 mixins 中更改 mixins 参数

转载 作者:行者123 更新时间:2023-11-28 12:48:34 27 4
gpt4 key购买 nike

我在另一个 mixins 中有一个 mixins

 .background(@url:  @base-url , @repeat: repeat, @pos1: left, @pos2: center, @color: transparent){
background:@arguments;
}

用于:

.divider{
overflow:hidden;
.background(@url: url("@{base-url}/divider.png") , @repeat: repeat-x, @pos2: bottom);
}

.class{
.divider;

}

是否可以仅更改 .divider 混入中的 @pos2

最佳答案

当然可以,将参数添加到您的 .divider mixin 并按如下方式使用该参数:

.divider(@pos2: bottom) {
overflow:hidden;
.background(url("@{base-url}/divider.png"), repeat-x, @pos2);
}

.class{
.divider(top); // you can use whatever value you want, or ignore it to use the default value 'bottom'
}

关于css - 在另一个 mixins 中更改 mixins 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24541172/

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