SASS常用方法
SASS的一些常用方法,整理一下
数组
| 1 | $marginL: 1px 2px 3px; | 
部件
方法
| 1 | @mixin a{width: 100px}; | 
默认参数
| 1 | 传入默认参数,当无传参时使用 | 
extend继承
| 1 | .a{width: 100px} | 
@at-root
嵌套在样式中使其输出到样式表的顶层
| 1 | @at-root{代码} | 
if检测
判断数值
| 1 | if type-of($width) != number { | 
判断数值是否有单位
| 1 | if not unitless($width){ | 
接下来是常用的部件
calc计算
| 1 | @mixin calc($property, $expression) { | 
清理浮动
| 1 | /* 清理浮动代码 */ | 
常用路径规划
$img: '../img/';
文件里用法
background: url("#{$img}logo3.png") no-repeat;
koala不支持中文注释
打开
Koala\rubygems\gems\sass-3.4.9\lib\sass
修改engine.rb,在require最下面加入
Encoding.default_external = Encoding.find('utf-8')
避免运算
加上括号就行
多个SCSS文件
加上下划线,就不会编译了,整合SCSS有用 style.scss加上
@import "scss/header";
!important
display: block !important;
