less学习-语法(二)

  1. 变量 @color1:#fff;
  2. 选择器 
    // Variables
    @mySelector: banner;
    
    // Usage
    .@{mySelector} {
      font-weight: bold;
      line-height: 40px;
      margin: 0 auto;
    }
  3. 图片域名

    // Variables
    @images: "../img";
    
    // 用法
    body {
      color: #444;
      background: url("@{images}/white-sand.png");
    }
  4. 变量的变量

    @fnord:  "I am fnord.";
    @var:    "fnord";
    content: @@var;
    
  5. 当前域变量

    @var: 0;
    .class1 {
      @var: 1;
      .class {
        @var: 2;
        three: @var;
        @var: 3;
      }
      one: @var;
    }
    1.one:1 当前域名
    2 tree:3 当前域的最后一个决定
    

      

  6. TODO http://less.bootcss.com/features/#variables-feature

     附:http://less.bootcss.com/features/

原文地址:https://www.cnblogs.com/jdhu/p/4375152.html