标签:border highlight htm style 函数 for ack span return
@length:100px; @color:yellow; @opa:0.5;
#div1{ width: @length; height: @length; background-color: @color; opacity: @opa; .borderRadius; .setMargin(top_,10px); }
.setMargin(top_,@width){ margin-top: @width; } .setMargin(bottom_,@width){ margin-bottom: @width; } .setMargin(@_,@width){ padding: 10px; }
.setMargin(top_,10px);
section{ p{ color: blueviolet; background-color: #00FFFF; text-align: center; } ul{ padding: 0px; list-style: none; li{ float: left; margin: 10px; width: 100px; border: 3px solid #00CED1; text-align:center; &:hover{ background-color: cornflowerblue; color: white; } }; } }
border: #{$i}px solid red;
@mixin hong($color:yellow){ color: $color; }
调用@include name(value);
@include hong;
.class{ padding: 10px; }
调用:@extend.class;
@extend .class;
>>>优点:继承的相同代码,可以提取到并集选择器;不会生成同名的class选择器
@for $i from 1 through 4{ .border#{$i}{ border: #{$i}px solid red; } }
7、while循环结构
$j:1; @while $j<4{ .while#{$j}{ border:#{$j}px solid red; } $j:$j+1; }
8、each循环遍历
@function func($length){ $length:$length*5; @return $length; }
【Sass中的嵌套】
section{ p{ color: #2173B6; background-color: #00FFFF; } ul{ padding: 0px; list-style: none; li{ float: left; width: 100px; text-align: center; margin: 10px; border: { color: #4E81BD; style:solid; width: 10px; }; &:hover{ background-color: #6495ED; color: white; } } } }
标签:border highlight htm style 函数 for ack span return
原文地址:http://www.cnblogs.com/dealblog/p/6792731.html