美文网首页
less 使用

less 使用

作者: 日不落000 | 来源:发表于2018-08-20 17:49 被阅读11次

    less 根据屏幕大小适配

    .screen-color {
      @media screen {
        color: green;
        @media (min-width: 768px) {
          color: red;
        }
      }
      @media tv {
        color: black;
      }
    }
    

    output:

    @media screen {
      .screen-color {
        color: green;
      }
    }
    @media screen and (min-width: 768px) {
      .screen-color {
        color: red;
      }
    }
    @media tv {
      .screen-color {
        color: black;
      }
    }
    

    参考链接:
    http://lesscss.cn/features/#variables-feature


    混合(Mixins)

    "mix-in" properties from existing styles

    You can mix-in class selectors and id selectors, e.g.

    .a, #b { color: red; } 
    .mixin-class { .a(); } 
    .mixin-id { #b(); }
    
    

    which results in:

    .a, #b { color: red; } 
    .mixin-class { color: red; }
    .mixin-id { color: red; }
    

    参考链接:
    https://less.bootcss.com/#-mixins-

    https://less.bootcss.com/#-variables-


    相关文章

      网友评论

          本文标题:less 使用

          本文链接:https://www.haomeiwen.com/subject/thgliftx.html