我尝试在 http://lesselements.com/ 使用 LESS Elements 我下载了LESS Elements ,然后像这样导入它:
@import "elements.less";
在我的 application.html.haml 中,我尝试这样使用它:
.row{:style=>'height: 105px; gradient(#00F5F5, #EEE, #FFF);'}
我已经在使用 twitter bootstrap,你可以看到上面的行类。 但是,结果 div 是纯白色的,知道吗?
最佳答案
Mixins 以“.”开头。
.row{ style: "height: 105px; .gradient(#00F5F5, #EEE, #FFF);" }
你也可以用一个类来代替(这在运行时会更有效率)
你的 Controller .css.less
@import "elements.less"
.gradient-row {
.gradient(#00F5F5, #EEE, #FFF);
}
你的 View .html.haml
.row.gradient-row{style: "height: 105px;"}
关于css - 如何在 Rails 中使用 LESS Elements?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11915107/