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 发布文章使用:只允许注册用户才可以访问!


最新文章

  1. AFNetwork源码解析
  2. 基于C++/Lua的游戏服务器如何实现?
  3. Lua Rings库介绍
  4. C# TextBox中只允许输入数字的方法
  5. QDomDocument Access violation writing location
  6. cad实时平移快捷键
  7. 【锋利的Jquery】读书笔记五
  8. 搜索suggestion
  9. Linux shell查询ip归属地
  10. ZZZPHP1.61 代码审计-从SQL注入到Getshell
  11. 3.2.3 SpringMVC注解式开发
  12. 【开发】iOS入门 - Touch事件处理学习笔记
  13. node基础—模块系统
  14. Vue 结合 Axios 接口超时统一处理
  15. 【netcore入门】在Windows IIS上部署.NET Core 2.1项目
  16. JavaScript笔记 #07# 用js写算法
  17. 【消息队列】kafka是如何保证消息不被重复消费的
  18. CasperJS断言
  19. December 24th 2016 Week 52nd Saturday
  20. 1095 Cars on Campus

热门文章

  1. ProBuilder快速原型开发技术 ---ProBuilder基础操作
  2. 聊聊.net应用程序的Docker镜像
  3. C# socket 阻止模式与非阻止模式应用实例
  4. Python+Selenium+Unittest实现PO模式web自动化框架(6)
  5. new() 和 make() 的区别 var arr1 = new([5]int) var arr2 [5]int
  6. Autofac for AutoMapper
  7. 《进击吧!Blazor!》第一章 3.页面制作
  8. KMP算法 字符串匹配(看猫片)
  9. 圣诞快乐!OIer挂分小技巧
  10. 22.firewalld