Less(Learner Style Sheets)是向后兼容css扩展语言。

变量(Variables)

 @width: 10px;
@height: @width + 10px;
header{
width: @width;
height: @height;
}

编译后等同于:

 header{
width: 10px;
height:20px;
}

混合(Mixins)

 .bordered{
border-top: 1px solid black;
border-bottom: 1px solid black;
} a{
.bordered();
}

嵌套(Nesting)

 #aa{
color: black;
#bb{
font-size: 20px;
}
.cc{
width: 300px;
}
}
#aa{
color: black;
#bb{
font-size: 20px;
}
.cc{
width: 300px;
&:hover{
height:300px;
}
}
}

适配屏幕(@supports、@media)

 .component {
width: 300px;
@media (min-width: 768px) {
width: 600px;
@media (min-resolution: 192dpi) {
background-image: url(/img/retina2x.png);
}
}
@media (min-width: 1280px) {
width: 800px;
}
}

运算(Operations)

 @color: #224488 / 2; //results in #112244

 @var: 50vh/2;
width: calc(50% + (@var - 20px)); // result is calc(50% + (25vh - 20px))
 @min768: (min-width: 768px);
.element {
@media @min768 {
font-size: 1.2rem;
}
}

函数(Functions)

 #bundle() {
.button {
display: block;
border: 1px solid black;
background-color: grey;
&:hover {
background-color: white;
}
}
.tab { ... }
.citation { ... }
}
 #header a {
color: orange;
#bundle.button(); // can also be written as #bundle > .button
}

Maps

 #colors() {
primary: blue;
secondary: green;
} .button {
color: #colors[primary];
border: 1px solid #colors[secondary];
}

作用域(Scope)

 @var: red;

 #page {
#header {
color: @var; // white
}
@var: white;
}
 @import "xx.css";

最新文章

  1. 记录DIV中滚动位置刷新页面位置保持不变
  2. 关于mysql数据库行级锁的使用(一)
  3. 高可用与负载均衡(1)之linux系统的数据链路层负载均衡
  4. Oracle分页查询语句
  5. Xfce 快捷键
  6. Android 混淆与混淆过滤
  7. Centos系统备份与恢复教程
  8. 【原创】深度神经网络(Deep Neural Network, DNN)
  9. 动态代理入门(jdk)
  10. 牢记负载均衡与HA,高性能是不同的方案。一般的CLUSTER只能实现其中的一种,而ORACLE的RAC可以有两种。
  11. [Swust OJ 771]--奶牛农场(几何题,画图就好)
  12. Python的内置函数open()的注意事项
  13. 团队作业8——第二次项目冲刺(Beta阶段)Day4--5.21
  14. Django学习日记03_模型_Fields
  15. 数据结构 之 并查集(Disjoint Set)
  16. linux服务器硬盘IO读写负载高来源定位 pt-ioprofile
  17. Pyenv部署
  18. Django Form表单组件
  19. SQL中exsit和in
  20. Ng第六课:逻辑回归(Logistic Regression)

热门文章

  1. java AQS 一:
  2. Delphi 带星期几的日期格式化
  3. unity中多个门的开关动画保持独立性
  4. 2018网站Https升级完全攻略
  5. optimal-account-balancing
  6. anytime
  7. React中this.setState是同步还是异步?为什么要设计成异步?
  8. 本地安装了Maven但Eclipse的Preferences中没有Maven怎么办?
  9. Java中java.util.concurrent包下的4中线程池代码示例
  10. SecureCRT通过SSH2协议远程登录Ubuntu 18.04的过程总结