gpt4 book ai didi

css - 如何在 css less 中返回 "text"?

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

我怎样才能做这样的事情:?

.test1(@light: 1px;){
"inset 0 @light 0 rgba(255, 255, 255, 0.2)";
}
.test2(@elevation: 3px;){
"0 @elevation 0 rgba(000, 000, 000, 0.1)";
}

@testing: .test1() "," .test2();
box-shadow: @testing;

最佳答案

我推荐以下方法:

// Box shadow.
.mx-box-sh (@arguments) {
-webkit-box-shadow: @arguments;
-moz-box-shadow: @arguments;
box-shadow: @arguments;
}

// Mixin for your specific needs.
.mx-my-box-sh (@light: 1px, @elevation: 3px) {
.mx-box-sh(e(%("inset 0 %s 0 rgba(255, 255, 255, 0.2), 0 %s 0 rgba(0, 0, 0, 0.1)", @light, @elevation)));
}

// Call the mixin.
.my-selector {
.mx-my-box-sh();
}

确保您使用的是最新的 LESS 编译器 (1.4.0)。

据我所知,你不能从 mixin 中“返回”文本。事实上,Mixin 是不返回任何内容的过程结构。

关于css - 如何在 css less 中返回 "text"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17010242/

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