Sass-@for,@while,@each
来源:互联网 发布:pywin32 知乎 编辑:程序博客网 时间:2024/06/05 03:47
本章介绍Sass-@for,@while,@each语法及使用
@charset "utf-8";//@for//1-10 包含10@for $i from 1 through 10{ .item_#{$i}{ background-position: -($i - 1) * 20px 0; }}//1-10 不包含10(1-9)@for $i from 1 to 10{ .item_#{$i}{ background-position: -($i - 1) * 20px 0; }}// @while$a:5;@while($a >= 1){ .aaa_#{$a}{ width: 20px * $a; } $a:$a - 1;}// @each$icon_name:user,pass,checked,select;@each $i in $icon_name{ .icon_#{$i}{ width: 10px; }}
sass编译后
.item_1 { background-position: 0px 0; }.item_2 { background-position: -20px 0; }.item_3 { background-position: -40px 0; }.item_4 { background-position: -60px 0; }.item_5 { background-position: -80px 0; }.item_6 { background-position: -100px 0; }.item_7 { background-position: -120px 0; }.item_8 { background-position: -140px 0; }.item_9 { background-position: -160px 0; }.item_10 { background-position: -180px 0; }.item_1 { background-position: 0px 0; }.item_2 { background-position: -20px 0; }.item_3 { background-position: -40px 0; }.item_4 { background-position: -60px 0; }.item_5 { background-position: -80px 0; }.item_6 { background-position: -100px 0; }.item_7 { background-position: -120px 0; }.item_8 { background-position: -140px 0; }.item_9 { background-position: -160px 0; }.aaa_5 { width: 100px; }.aaa_4 { width: 80px; }.aaa_3 { width: 60px; }.aaa_2 { width: 40px; }.aaa_1 { width: 20px; }.icon_user { width: 10px; }.icon_pass { width: 10px; }.icon_checked { width: 10px; }.icon_select { width: 10px; }
0 0
- Sass-@for,@while,@each
- SASS详解之控制指令(if、each、for和while)
- sass循环 each、for
- Sass的@each指令
- Sass的@while指令
- 【代码优化】for-each代替普通的for循环或者while循环
- for each
- for each
- for each
- for each
- for each
- FOR EACH
- for-each
- for-each
- for each
- VBA 中 do-loop,do-while-loop,do-until-loop,for-each-next 的小例子
- for、for-each、迭代器
- Sass使用for循环
- PAT A1073. Scientific Notation (20)
- Dagger2
- ruby on rails 常用的记录
- db2中关于递归(with)的使用
- 缓存图片解决方案(来自stackoverflow)
- Sass-@for,@while,@each
- AndroidStudio2.2.3 的使用
- 1.模型评估的方法与性能度量
- 在Java项目中如何使用log4j和slf4j实现日志打印
- Android实现百度地图
- URL地址中有中文,但是在tomcat服务器中不显示
- C++函数的参数传递、返回值及函数声明
- Apache与Nginx的优缺点比较
- JS显示时钟精确到毫秒