zoukankan      html  css  js  c++  java
  • Sass @mixin 与 @include

    Sass @mixin 与 @include

    @mixin 指令允许我们定义一个可以在整个样式表中重复使用的样式。

    @include 指令可以将混入(mixin)引入到文档中。

    @mixin important-text {
      color: red;
      font-size: 25px;
      font-weight: bold;
      border: 1px solid blue;
    }
    

      

    .danger {
      @include important-text;
      background-color: green;
    }
    

      

    向混入传递变量

    /* 混入接收两个参数 */
    @mixin bordered($color, $width) {
      border: $width solid $color;
    }
    
    .myArticle {
      @include bordered(blue, 1px);  // 调用混入,并传递两个参数
    }
    
    .myNotes {
      @include bordered(red, 2px); // 调用混入,并传递两个参数
    }
    

      

  • 相关阅读:
    【leetcode】二叉搜索树的最近公共祖先
    052-12
    052-11
    052-10
    052-9
    052-8
    052-6
    052-5
    052-3
    052-2
  • 原文地址:https://www.cnblogs.com/ckmouse/p/12767142.html
Copyright © 2011-2022 走看看