zoukankan      html  css  js  c++  java
  • xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

    SCSS variable for loop All In One

    @each

    $r: red;
    $g: green;
    $b: blue;
    
    $colors: (
      1: $r,
      2: $g,
      3: $b,
    );
    
    .container-color {
      @each $key, $val in $colors {
        &-#{$key} {
          color: $val;
        }
      }
    }
    
    
    .container-color-1 {
        color: red;
    }
    
    .container-color-2 {
        color: green;
    }
    
    .container-color-3 {
        color: blue;
    }
    
    
    

    @for

    
    /* warning: this is generally a bad idea */
    @for $i from 1 through 3 {
      .tooltips-container-#{$i} {
        font-size: #{$i}px;
      }
    }
    
    
    
    /* warning: this is generally a bad idea */
    .tooltips-container-1 {
        font-size: 1px;
    }
    
    .tooltips-container-2 {
        font-size: 2px;
    }
    
    .tooltips-container-3 {
        font-size: 3px;
    }
    
    
    

    demo

    @for demo

    
        $min: 1;
        $max: 3;
        @for $i from $min through $max {
            .tooltips-container-#{$i} {
                position: relative;
            }
        }
    
    
    
    .tooltips-container-1 {
        position: relative;
    }
    
    .tooltips-container-2 {
        position: relative;
    }
    
    .tooltips-container-3 {
        position: relative;
    }
    
    
    

    @each demo

    
        .popover-custom-class {
            display: block !important;
            $l: left;
            $r: right;
            $t: top;
            $b: bottom;
            $positions: $l, $r, $t, $b;
            @each $key in $positions {
                &[x-placement^=#{$key}] .popper__arrow::after {
                    border-#{$key}-color: #409eff !important;
                }
            }
        }
    
    
    
    .popover-custom-class {
        display: block !important;
    }
    
    .popover-custom-class[x-placement^=left] .popper__arrow::after {
        border-left-color: #409eff !important;
    }
    
    .popover-custom-class[x-placement^=right] .popper__arrow::after {
        border-right-color: #409eff !important;
    }
    
    .popover-custom-class[x-placement^=top] .popper__arrow::after {
        border-top-color: #409eff !important;
    }
    
    .popover-custom-class[x-placement^=bottom] .popper__arrow::after {
        border-bottom-color: #409eff !important;
    }
    
    
    

    refs

    https://sass.js.org/

    https://sass-lang.com/documentation/at-rules/control/for

    https://sass-lang.com/documentation/at-rules/control/each



    ©xgqfrms 2012-2020

    www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


  • 相关阅读:
    如何让 PADS Layout 识别到板框
    笔记:理想和挣钱
    笔记:知数据不知情况
    关于ie6下拖动滚动条时,div抖动的问题解决
    jQuery 中屏蔽浏览器的F5刷新功能
    jQuery 的append在ie下的兼容性
    协程
    进程
    操作系统的发展史
    python_控制台输出带颜色的文字方法
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/14217526.html
Copyright © 2011-2022 走看看