Twitter bootstrap 如何使用引导梯度混合?

Twitter bootstrap 如何使用引导梯度混合?,twitter-bootstrap,meteor,twitter-bootstrap-3,less,Twitter Bootstrap,Meteor,Twitter Bootstrap 3,Less,如何使用梯度混合器?mixin文件声明如下: #渐变{ .vertical(@start color:#555;@end color:#333;@start percent:0%;@end percent:100%){ 我试过了#gradient.vertical(),#gradient>.vertical()等等 我需要进口什么东西吗 这是使用nemo64:bootstrap-less软件包和meteor来设计整个网页的背景。例如,使用: 例如,要设置整个网页的背景样式,请使用: #gra

如何使用梯度混合器?mixin文件声明如下:

#渐变{
.vertical(@start color:#555;@end color:#333;@start percent:0%;@end percent:100%){

我试过了
#gradient.vertical()
#gradient>.vertical()
等等

我需要进口什么东西吗


这是使用nemo64:bootstrap-less软件包和meteor来设计整个网页的背景。例如,使用:


例如,要设置整个网页的背景样式,请使用:

#gradient>.vertical();
应该可以正常工作。请确保已导入混音

对于引导,您可以同时导入
less/mixins.less
less/mixins/gradient.less

正如@Robert所解释的,您应该在选择器中调用mixin:

@import "less/mixins";
div {
#gradient > .vertical();
}
产出:

div {
  background-image: -webkit-linear-gradient(top, #555555 0%, #333333 100%);
  background-image: -o-linear-gradient(top, #555555 0%, #333333 100%);
  background-image: linear-gradient(to bottom, #555555 0%, #333333 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff555555', endColorstr='#ff333333', GradientType=0);
}

这是使用nemo64:meteor的无引导包

你应该阅读其中包含的一些例子

@nemo64 wrotes:

尽管如此,引导混合和变量仍然可用 custom.bootstrap.import.less,它只包含mixin和变量 因此,您可以随时导入它


因此,在调用mixin之前,应该导入
custom.bootstrap.import.less

更新

那么..不应该梯度>垂直(#ff0000,#00ff00,50%,50%)工作吗

是的,应该是这样

meteor创建测试应用程序后
do
cd测试应用程序
然后运行
meteor添加nemo64:bootstrap less

现在创建一个空的
custom.bootstrap.json
,您的文件结构应该如下所示:

├── custom.bootstrap.json
├── test-app.css
├── test-app.html
└── test-app.js
运行
meteor
命令后,文件结构应如下所示:

├── custom.bootstrap.json
├── custom.bootstrap.less
├── custom.bootstrap.mixins.import.less
├── test-app.css
├── test-app.html
└── test-app.js
然后创建一个
gradient.less
文件,该文件应包含以下less代码:

h1 {
#gradient > .vertical(#ff0000, #00ff00, 50%, 50%);
}
再次运行
meteor
命令,现在打开应用程序
http://localhost:3000/
应与下图所示的类似:

#gradient>.vertical();
应该可以工作。请确保导入了混音器

对于引导,您可以同时导入
less/mixins.less
less/mixins/gradient.less

正如@Robert所解释的,您应该在选择器中调用mixin:

@import "less/mixins";
div {
#gradient > .vertical();
}
产出:

div {
  background-image: -webkit-linear-gradient(top, #555555 0%, #333333 100%);
  background-image: -o-linear-gradient(top, #555555 0%, #333333 100%);
  background-image: linear-gradient(to bottom, #555555 0%, #333333 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff555555', endColorstr='#ff333333', GradientType=0);
}

这是使用nemo64:meteor的无引导包

你应该阅读其中包含的一些例子

@nemo64 wrotes:

尽管如此,引导混合和变量仍然可用 custom.bootstrap.import.less,它只包含mixin和变量 因此,您可以随时导入它


因此,在调用mixin之前,应该导入
custom.bootstrap.import.less

更新

那么..不应该梯度>垂直(#ff0000,#00ff00,50%,50%)工作吗

是的,应该是这样

meteor创建测试应用程序后
do
cd测试应用程序
然后运行
meteor添加nemo64:bootstrap less

现在创建一个空的
custom.bootstrap.json
,您的文件结构应该如下所示:

├── custom.bootstrap.json
├── test-app.css
├── test-app.html
└── test-app.js
运行
meteor
命令后,文件结构应如下所示:

├── custom.bootstrap.json
├── custom.bootstrap.less
├── custom.bootstrap.mixins.import.less
├── test-app.css
├── test-app.html
└── test-app.js
然后创建一个
gradient.less
文件,该文件应包含以下less代码:

h1 {
#gradient > .vertical(#ff0000, #00ff00, 50%, 50%);
}
再次运行
meteor
命令,现在打开应用程序
http://localhost:3000/
应如下图所示:


custom.bootstrap.import.less
是我尝试使用mixin的地方。我在文件的开头导入了
custom.bootstrap.mixin.import.less
。在
mixin.import.less
文件中指定的渐变语法是
(@start-color:#555;@end-color:#333;@start-center:0%;@end-center:100%)
work?
custom.bootstrap.import.less
是我尝试使用mixin的地方。我在文件开头导入了
custom.bootstrap.mixin.import.less
渐变。在
mixin.import.less
文件中指定的语法是
.vertical(@start-color:#555;@end-color:#333;@start-percent:0%;@end-percent:100%)