less常用base级别的基础代码

 1 //display
 2 .db(){display: block}
 3 .di(){display: inline}
 4 .dib(){display: inline-block}
 5 
 6 //
 7 .tdn(){text-decoration: none;}
 8 
 9 //background
10 //.back(@url,@c){@c @url center center no-repeat;}
11 //margin padding
12 .m(@m){margin: @m;}
13 .mt(@mt){margin-top: @mt;}
14 .ml(@ml){margin-left: @ml;}
15 .mr(@mr){margin-right: @mr;}
16 .mb(@mb){margin-bottom: @mb;}
17 .p(@p){padding: @p;}
18 .pt(@pt){padding-top: @pt;}
19 .pl(@pl){padding-left: @pl;}
20 .pr(@pr){padding-right: @pr;}
21 .pb(@pb){padding-bottom: @pb;}
22 
23 .m0{.m(0)}
24 .mt0{.mt(0)}
25 .mb0{.mb(0)}
26 .mr0{.mr(0)}
27 .ml0{.ml(0)}
28 .p0{.p(0)}
29 .pt0{.pt(0)}
30 .pb0{.pb(0)}
31 .pr0{.pr(0)}
32 .pl0{.pl(0)}
33 
34 //height line-height
35 .h(@h){height:@h}
36 .lh(@lh){line-height:@lh}
37 .w(@w){width:@w}
38 //fz
39 .fz(@fz){font-size: @fz;}
40 
41 //color
42 .c(@c) when (iscolor(@c)){color:@c}
43 //text
44 .tl(){text-align: left}
45 .tr(){text-align: right}
46 .tc(){text-align: center}
47 .tj(){text-align: justify}
48 .tin2(){text-indent: 2em;}
49 
50 .vm(){vertical-align: middle;}
51 
52 //border
53 .b(@c:#f00,@w:1px,@s:solid) when (iscolor(@c)) and (isnumber(@w)) and (iskeyword(@s)){border:@w @s @c}
54 .bb(@c:#f00,@w:1px,@s:solid) when (iscolor(@c)) and (isnumber(@w)) and (iskeyword(@s)){border-bottom:@w @s @c}
55 .bt(@c:#f00,@w:1px,@s:solid) when (iscolor(@c)) and (isnumber(@w)) and (iskeyword(@s)){border-top:@w @s @c}
56 .bl(@c:#f00,@w:1px,@s:solid) when (iscolor(@c)) and (isnumber(@w)) and (iskeyword(@s)){border-left:@w @s @c}
57 .br(@c:#f00,@w:1px,@s:solid) when (iscolor(@c)) and (isnumber(@w)) and (iskeyword(@s)){border-right:@w @s @c}

 

posted @ 2016-11-24 18:16  HALEY168  阅读(677)  评论(0编辑  收藏  举报