如何在 lesscss 中将参数从 mixin 传递到另一个?
我在 Drupal 7.8 中使用 LESS CSS 模块 7.x-2.4 我想使用将参数传递给另一个 mixin 的样式 mixin。在示例中,将颜色作为字符串“#CC00CC”传递可以正常工作,但不能作为“darken(@col, 10%)”这样的变量传递。
@bg(@colBg){
background-color: @colBg;
}
@style(@col){
border: 2px solid lighten(@col, 10%); // ok
@bg(#CC00CC); // ok - color is passed
@bg(darken(@col, 10%)); // Color is not being passed to @bg
}
.buttonSubmit{
@style(#FF00FF);
}
如何实现从 css 类到 mixnin 的级联变量,并将参数传递给另一个 mixin?
I'm using the LESS CSS module 7.x-2.4 in Drupal 7.8
I would like to use style mixins which pass arguments to another mixin. In the example passing the color as a string "#CC00CC" works ok, but not as an variable like that "darken(@col, 10%)".
@bg(@colBg){
background-color: @colBg;
}
@style(@col){
border: 2px solid lighten(@col, 10%); // ok
@bg(#CC00CC); // ok - color is passed
@bg(darken(@col, 10%)); // Color is not being passed to @bg
}
.buttonSubmit{
@style(#FF00FF);
}
How can I achieve cascading variables from the css-class to a mixnin which passes the argument to another mixin?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的语法不正确。查看关于 mixins 的文档。你的代码应该这样写:
Your syntax is incorrect. Check the docs on mixins. The code you have should be written like this: