forked from oliverholretz/css-reset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss-reset.less
298 lines (247 loc) · 6.22 KB
/
css-reset.less
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
/*
CSS Reset
Mark Howells-Mead | www.permanenttourist.ch | Initial version Autumn 2014. That's quite new.
See https://github.com/mhmli/css-reset for details
Make sure that you autoprefix if you're compiling your own CSS file
*/
// use border-box method on all elements
// see http://www.paulirish.com/2012/box-sizing-border-box-ftw/
// and http://callmenick.com/post/the-new-box-sizing-reset
*,
*::before,
*::after {
box-sizing: inherit;
}
html {
box-sizing: border-box;
}
//////////////////////////////////////////////////
// wide-reaching
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, main, section, summary,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
vertical-align:baseline;
background:transparent;
}
html, body, div, span, object, iframe,
p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, main, section, summary,
time, mark, audio, video {
font-size:100%;
}
// define HTML block elements (and their default margins) explicitly
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,main {
display: block;
margin: 0;
padding: 0;
}
//////////////////////////////////////////////////
// html and body
// Remove default margin and padding on the HTML and BODY tags and set them to the full browser width
html,body {
margin: 0;
padding: 0;
width: 100%;
}
// 1. Corrects text resizing oddly in IE 6/7 when body `font-size` is set using `em` units.
// 2. Prevents iOS text size adjust after orientation change, without disabling user zoom.
html {
background-color: #fff;
font-size: 100%; // 1
-webkit-text-size-adjust: 100%; // 2
-ms-text-size-adjust: 100%; // 2
}
body {
min-width: 240px; // Ensure that the body doesn't get too narrow in mobile resolutions
line-height: 1.5; // Improved line-height for better legibility
word-wrap: normal;
}
//////////////////////////////////////////////////
// attributes
// Styling for `hidden` attribute not present in IE 7/8/9, Firefox 3 and Safari 4.
[hidden] {
display: none;
}
// Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
audio, canvas, video {
display: inline-block;
*display: inline;
*zoom: 1;
}
// Prevents modern browsers from displaying `audio` without controls. Remove excess height in iOS 5 devices.
audio:not([controls]) {
display: none;
height: 0;
}
img {
height: auto;
max-width: 100%; // do not let images be wider than their containers
position: relative; // for rounded corners in IE8 (for compatability with CSS PIE)
vertical-align: middle; // ensure no inexplicable whitespace beneath image when it's wrapped in an A tag
-ms-interpolation-mode: bicubic; // Improves image quality when scaled in IE 7
}
iframe {
max-width: 100%;
border: none;
}
// make the horizontal lines a bit less ugly by default
hr {
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
height: 1px;
color: transparent;
background-color: transparent;
}
//////////////////////////////////////////////////
// list elements
ul {
padding: 0 0 0 1.2em;
margin: 0 0 1em;
}
ol {
margin: 0 0 1em 1.5em;
}
nav ul {
list-style: none;
padding: 0;
}
//////////////////////////////////////////////////
// typography
abbr, acronym {
border:0;
font-variant:normal;
}
address, caption, cite, code, dfn, th, var {
font-style:normal;
font-weight:normal;
}
a {
margin:0;
padding:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
abbr[title], dfn[title] {
border-bottom:1px dotted;
cursor:help;
}
blockquote {
quotes:none;
border-left: 5px solid #ccc;
margin-left: 0;
padding-left: 1em;
&:before, &:after {
content:'';
content:none;
}
}
caption, th {
text-align:left;
}
code,kbd,pre,samp {
font-family: monospace, serif;
_font-family: 'courier new', monospace;
font-size: 1em;
}
del {
text-decoration: line-through;
}
// paragraphs normally have a vertical margin before and after the element. this standardizes them so that there's only ever a margin after the element.
p {
margin:0 0 1em;
}
p,li,td,th,dd,dt,ul,ol,table,div,article,main,section,aside,nav,button,input,select,option,textarea,header {
font-size: 1em;
}
mark {
background: #ff0;
color: #000;
}
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
sup, sub {
line-height: 0;
position: relative;
top: -.4em;
font-size: .75em;
}
sub {
top: .2em;
}
//////////////////////////////////////////////////
// forms
form {
margin: 0;
}
input, textarea, legend, fieldset, keygen, select, button, isindex {
font-family: inherit;
*font-size:100%; // for IE pre v8
vertical-align:middle;
}
button,input[type=submit],input[type=reset],input[type=image],input[type=button] {cursor: pointer}
legend {
border: 0;
color: inherit; // Corrects color not being inherited in IE 6/7/8/9.
padding: 0;
white-space: normal; // Corrects text not wrapping in Firefox 3.
*margin-left: -.4375em; // Corrects alignment displayed oddly in IE 6/7.
}
// Unify button heights with link buttons in Firefox http://davidwalsh.name/firefox-buttons
input::-moz-focus-inner {
border: 0;
padding: 0;
}
input::-moz-focus-inner {
border: 0;
padding: 0;
margin-top:-2px;
margin-bottom: -2px;
}
// Stop iOS from zooming in when clicking into form fields. Standard font size on this device is 16px; other sizes don't stop the zoom effect.
@media screen and (-webkit-min-device-pixel-ratio:0) and (max-device-width: 1024px) {
select, textarea, input {
&:focus {
font-size: 16px;
}
}
}
//////////////////////////////////////////////////
// tables
table,th,td {
vertical-align: top;
border: 1px outset #999;
border-collapse: collapse; // stop elements from having duplicate borders where they collide.
}
table {
margin-bottom: 1em;
}
th,td {
text-align: left;
padding:2px 8px;
}