sass的循环写法实例
2016-02-02 18:33
267 查看
sass里面也有for的写法,在有些地方用着还是很方便的。
比如:下图的左侧所有icon
html写法:如下图,起名的时候还是要有规律的数字
sass写法:
i{
width: 18px;
height: 18px;
background:url(i/intro-icons.png) no-repeat;
background-size:18px 120px;
@for $i from 1 to 6{
i.intro-icon#{$i}{
background-position:0 -#{$i*20}px;
}
}
}
比如:下图的左侧所有icon
html写法:如下图,起名的时候还是要有规律的数字
sass写法:
i{
width: 18px;
height: 18px;
background:url(i/intro-icons.png) no-repeat;
background-size:18px 120px;
@for $i from 1 to 6{
i.intro-icon#{$i}{
background-position:0 -#{$i*20}px;
}
}
}
相关文章推荐
- UVA 10564_ Paths through the Hourglass
- UVA 10564_ Paths through the Hourglass
- .sh文件没权限
- JavaScript——prototype属性的apply方法和call方法
- linux如何安装jdk
- python访问redis
- Python+OpenCV实现图像高斯模糊
- 怎么对MySQL数据库操作大数据?这里有思路
- 怎么对MySQL数据库操作大数据?这里有思路
- 关于在项目中使用三方框架见解(volley和fresco)
- 最大公约数的运用
- Splinter学习--模拟攥写博客园随笔
- HashMap和HashTable的区别
- 持盈履满,君子兢兢
- app crash率的标准
- 6 继承
- VS2013出现应用程序无法正常启动
- java web 获取客户端真实IP
- IE10修改select样式
- ||C||<基础>C语言基础知识框架结构//个人整理使用|仅供参考|