嵌套規則
01 |
#header { color: black; }#header .navigation { font-size: 12px; |
04 |
}#header .logo:hover { text-decoration: none; |
07 |
#header { color: black; .navigation { font-size: 12px; |
08 |
} .logo { width: 300px; |
09 |
&:hover { text-decoration: none } |
變數:
2 |
@light-blue: @nice-blue + #111; |
3 |
#header { color: @light-blue; } |
偽類寫法:
COLOR顏色函數:
01 |
lighten(@color, 10%); // return a color which is 10% *lighter* than @color |
02 |
darken(@color, 10%); // return a color which is 10% *darker* than @color |
04 |
saturate(@color, 10%); // return a color 10% *more* saturated than @color |
05 |
desaturate(@color, 10%); // return a color 10% *less* saturated than @color |
07 |
fadein(@color, 10%); // return a color 10% *less* transparent than @color |
08 |
fadeout(@color, 10%); // return a color 10% *more* transparent than @color |
09 |
fade(@color, 50%); // return @color with 50% transparency |
11 |
spin(@color, 10); // return a color with a 10 degree larger in hue than @color |
12 |
spin(@color, -10); // return a color with a 10 degree smaller hue than @color |
14 |
mix(@color1, @color2); // return a mix of @color1 and @color2 |
DEMO_HTML:
Google/Firefox瀏覽器適用,IE瀏覽器不相容.
04 |
<meta charset="UTF-8"> |
05 |
<title>Document</title> |
06 |
<link rel="stylesheet/less" type="text/css" href="less/styles.less" /> |
07 |
<script src="less-1.5.0.min.js" type="text/javascript"></script> |
11 |
<div style="height:30px;color:#FFF;background-color:#000;">對照文本顏色</div> |
18 |
less.watch(); //自動重新整理 |