Less的模式匹配
来源:互联网 发布:apache ab url参数 编辑:程序博客网 时间:2024/06/02 02:40
Less的模式匹配
Less提供了一种机制,允许根据参数的值来改变 mixin的行为。比如,以下代码就可以让 .mixin 根据不同的 @switch 值而表现各异:
.mixin (dark, @color) {
color: darken(@color, 10%);
}
.mixin (light, @color) {
color: lighten(@color, 10%);
}
此时,在调用 .mixin 时:如果 @switch 设为 light,就会得到浅色;如果 @switch 设为 dark,就会得到深色。如,以下调用:
@switch: light;
.class1 {
.mixin(@switch, #888);
}
@switch2 : dark;
.class2 {
.mixin(@switch, #666);
}
编译后的CSS代码为:
.class1 {
color: #a2a2a2;
}
.class2 {
color: #808080;
}
阅读全文
0 0
- Less的模式匹配
- 串的模式匹配
- 字符串的模式匹配
- 串的模式匹配
- 串的模式匹配
- 字符串的模式匹配
- Python的模式匹配
- 串的模式匹配
- 串的模式匹配
- Erlang的模式匹配
- 串的模式匹配
- 串的模式匹配
- 字符串的模式匹配
- 串的模式匹配
- 串的模式匹配
- 字符串的模式匹配
- 模式匹配的问题
- lua的模式匹配
- Java将图片压缩至指定大小
- Java异常处理
- Centos 7.3 用户和组管理
- CF689B Mike and Shortcuts(单调队列/建图spfa/bfs)
- 跟着实例学习ZooKeeper的用法: 计数器
- Less的模式匹配
- JUnit4 注解基本介绍
- 我的博客即将入驻“云栖社区”,诚邀技术同仁一同入驻。
- 图像锐化处理
- 三年时光或许被学校糟蹋了
- 队花的烦恼一
- Windows下用命令行导出导入MySQL数据库
- 云星数据---Apache Flink实战系列(精品版)】:Flink流处理API详解与编程实战006-DataStream与MySql自定义sink和source(Scala版)001
- 网络请求