sass07 函数

scsss

@function double($width){  //自定义函数u
    @return $width * 2;
}

@function double($width){  //自定义函数u
    @if $width > 3px {
        //@error "大于3px";
    }
    @return $width * 2;
}


body{
    $color:rgb(255,255,255);
    color:$color;
    background-color:rgba($color,0.5);//透明度
    width:100px;
    height:100px;
    
    p{
        color:darken($color,2);//颜色加深
        font-size:str-length("aaaaaa");  //长度
        z-index:str-index("abcde","s");  //索引从1开始
        width:double(5px);
    }
}

@debug "This is a debug";
//@warn "warn"
//@error "error"

css

body {
  color: white;
  background-color: rgba(255, 255, 255, 0.5);
  width: 100px;
  height: 100px;
}
body p {
  color: #fafafa;
  font-size: 6;
  width: 10px;
}

/*# sourceMappingURL=demo1.css.map */

 

posted @ 2017-06-13 04:54  无天666  阅读(233)  评论(0编辑  收藏  举报