-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.less
More file actions
281 lines (238 loc) · 9.36 KB
/
reset.less
File metadata and controls
281 lines (238 loc) · 9.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
.f-reset(){
// @名称: reset.less
// @功能: 初始化各html标签,使其在所有浏览器下保持一致
// 配置文件定义在config.less里
// 防止用户自定义背景颜色对网页的影响
html{
color:@baseColor;
background:#fff;
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: none;
.f-wordBreak();
}
// 内外边距通常让各个浏览器样式的表现位置不同
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
margin:0;padding:0;
}
// 重设 HTML5 标签, IE 需要在 js 中 createElement(TAG)
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {display:block;}
// HTML5 媒体文件跟 img 保持一致
audio,canvas,video {display: inline-block;*display: inline;*zoom:1;}
audio:not([controls]) {display: none;}
// 要注意表单元素并不继承父级 font 的问题
body,button,input,select,textarea{font:@baseFontSize~"/@{baseLineHeight}" @baseFontFamily;}
input,select,textarea{font-size:100%;background:#fff;}
// 去掉各Table cell 的边距并让其边重合,防止表格内文字不能换行
table{border-collapse:collapse;border-spacing:0;table-layout:fixed;word-wrap:break-word;word-break:break-all;width:100%;vertical-align:top}
th,td{vertical-align: top}
// IE bug fixed: th 不继承 text-align
th{text-align:inherit;}
// 去除默认边框
fieldset,img{border:none;}
// ie6 7 8(q) bug 显示为行内表现
iframe{display:block;}
// 去掉 firefox 下此元素的边框
abbr,acronym{border:none;font-variant:normal;}
// 一致的 del 样式
del {text-decoration:line-through;}
address,caption,cite,code,dfn,em,th,var {font-style:normal;font-weight:500;}
// 去掉列表前的标识, li 会继承(在ie7下有时会不继承)
ol,ul,li {list-style:none;}
// 对齐是排版最重要的因素, 别让什么都居中
caption,th {text-align:left;}
// 让标题都自定义, 适应多个系统应用
h1,h2,h3,h4,h5,h6 {font-size:100%;font-weight:700;}
q:before,q:after {content:'';}
// 统一上标和下标
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline;}
sup {top: -0.5em;}
sub {bottom: -0.25em;}
// 默认不显示下划线,保持页面简洁
ins,a { text-decoration:none;}
a{color:@linkColor;}
a:focus {outline: thin dotted #333;outline: 5px auto -webkit-focus-ring-color;outline-offset: -2px;}
a:hover,a:active {outline: 0;text-decoration:underline;}
a:hover{color:@linkColorHover;}
//单字母勾子元素
s,u,q,i,b{text-decoration:none;font-style:normal;font-weight:normal}
//文本框美化 增加高级浏览器呼吸效果(textarea同样适用)
.text,textarea{ border:1px solid #ccc;vertical-align:top;color:#333}
.text{height:25px;padding-left:6px;line-height:~"25px\9"}
textarea{padding:4px 0 7px 6px;overflow:auto}
.text:hover,textarea:hover{border-color:#999}
.text:focus, textarea:focus {border-color:#d1ba8a;.f-transition("border linear .2s,-moz-box-shadow linear .5s");.f-boxShadow("0 0 3px rgba(209,187,138,.3)");}
.text.grey,textarea.grey{color:#ccc !important}
//文本框readonly样式
.text.readonly, textarea.readonly{border-color:#ccc;background:#F1F1F1;color:#ccc;cursor:default;resize:none;.f-boxShadow("0 0 0");}
//按钮
button,.btn{border:none;cursor: pointer;}
::selection {
text-shadow:none;
background: @blue;
color:@white;
}
.clear{.f-clearfix();}
// 居中盒容器
.-box-fluid,.-box{
margin:0 auto;
.f-clearfix();
.-left{float:left;}
.-right{float: right}
.inline{.f-inlineBlock}
}
.-box-fluid{
width:95%;
max-width:@maxWidth;
min-width:@minWidth;
}
.-box{
width: @minWidth;
max-width:@minWidth;
}
// // 流式列布局
// .makeFluid();
//圣杯布局
.-fluid-cup{
@leftWidth:260px;
width:100%;
.f-clearfix();
.-main{
float: left;
width: 100%;
}
.-main-wrap{
// border: 1px solid #f00;
margin-left:@leftWidth;
}
.-sub{
width:@leftWidth;
float:left;
margin-left: -100%
}
.-extra{
}
}
.input-block-level() {
display: block;
width: 100%;
// min-height: @inputHeight; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
// .f-box-sizing(border-box); // Makes inputs behave like true block-level elements
}
//
// Grid system
// --------------------------------------------------
#grid {
.core (@gridColumnWidth, @gridGutterWidth) {
.spanX (@index) when (@index > 0) {
.span@{index} { .span(@index); }
.spanX(@index - 1);
}
.spanX (0) {}
.offsetX (@index) when (@index > 0) {
.offset@{index} { .offset(@index); }
.offsetX(@index - 1);
}
.offsetX (0) {}
.offset (@columns) {
margin-left: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns + 1));
}
.span (@columns) {
width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
}
.row {
margin-left: @gridGutterWidth * -1;
.f-clearfix();
}
[class*="span"] {
float: left;
min-height: 1px; // prevent collapsing columns
margin-left: @gridGutterWidth;
}
// Set the container width, and override it for fixed navbars in media queries
.container,
.navbar-static-top .container,
.navbar-fixed-top .container,
.navbar-fixed-bottom .container { .span(@gridColumns); }
// generate .spanX and .offsetX
.spanX (@gridColumns);
.offsetX (@gridColumns);
}
.fluid (@fluidGridColumnWidth, @fluidGridGutterWidth) {
.spanX (@index) when (@index > 0) {
.span@{index} { .span(@index); }
.spanX(@index - 1);
}
.spanX (0) {}
.offsetX (@index) when (@index > 0) {
.offset@{index} { .offset(@index); }
.offset@{index}:first-child { .offsetFirstChild(@index); }
.offsetX(@index - 1);
}
.offsetX (0) {}
.offset (@columns) {
margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth*2);
*margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + (@fluidGridGutterWidth*2) - (.5 / @gridRowWidth * 100 * 1%);
}
.offsetFirstChild (@columns) {
margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth);
*margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%);
}
.span (@columns) {
width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1));
*width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%);
}
.row-fluid {
width: 100%;
.f-clearfix();
[class*="span"] {
// .input-block-level();
float: left;
margin-left: @fluidGridGutterWidth;
*margin-left: @fluidGridGutterWidth - (.5 / @gridRowWidth * 100 * 1%);
}
[class*="span"]:first-child {
margin-left: 0;
}
// Space grid-sized controls properly if multiple per line
.controls-row [class*="span"] + [class*="span"] {
margin-left: @fluidGridGutterWidth;
}
// generate .spanX and .offsetX
.spanX (@gridColumns);
.offsetX (@gridColumns);
}
}
.input(@gridColumnWidth, @gridGutterWidth) {
.spanX (@index) when (@index > 0) {
input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index} { .span(@index); }
.spanX(@index - 1);
}
.spanX (0) {}
.span(@columns) {
width: ((@gridColumnWidth) * @columns) + (@gridGutterWidth * (@columns - 1)) - 14;
}
input,
textarea,
.uneditable-input {
margin-left: 0; // override margin-left from core grid system
}
// Space grid-sized controls properly if multiple per line
.controls-row [class*="span"] + [class*="span"] {
margin-left: @gridGutterWidth;
}
// generate .spanX
.spanX (@gridColumns);
}
}
// Fixed (940px)
#grid > .core(@gridColumnWidth, @gridGutterWidth);
// Fluid (940px)
#grid > .fluid(@fluidGridColumnWidth, @fluidGridGutterWidth);
.pull-left{
float: left;
}
.pull-right{
float: right;
}
}