_reboot.scss 11.2 KB
Newer Older
1
// scss-lint:disable QualifyingElement, DuplicateProperty, VendorPrefix
Mark Otto's avatar
Mark Otto committed
2

Mark Otto's avatar
Mark Otto committed
3
// Reboot
4
//
5
6
7
8
// Normalization of HTML elements, manually forked from Normalize.css to remove
// styles targeting irrelevant browsers while applying new styles.
//
// Normalize is licensed MIT. https://github.com/necolas/normalize.css
Jacob Thornton's avatar
Jacob Thornton committed
9

10

11
// Document
Mark Otto's avatar
Mark Otto committed
12
//
13
14
15
16
17
18
19
// 1. Change from `box-sizing: content-box` so that `width` is not affected by `padding` or `border`.
// 2. Change the default font family in all browsers.
// 3. Correct the line height in all browsers.
// 4. Prevent adjustments of font size after orientation changes in IE on Windows Phone and in iOS.
// 5. Setting @viewport causes scrollbars to overlap content in IE11 and Edge, so
//    we force a non-overlapping, non-auto-hiding scrollbar to counteract.
// 6. Change the default tap highlight to be completely transparent in iOS.
20

21
22
23
*,
*::before,
*::after {
24
  box-sizing: border-box; // 1
25
26
27
}

html {
28
29
30
  font-family: sans-serif; // 2
  line-height: 1.15; // 3
  -webkit-text-size-adjust: 100%; // 4
31
  -ms-text-size-adjust: 100%; // 4
32
33
  -ms-overflow-style: scrollbar; // 5
  -webkit-tap-highlight-color: rgba(0,0,0,0); // 6
Chris Rebert's avatar
Chris Rebert committed
34
}
35

36
// IE10+ doesn't honor `<meta name="viewport">` in some cases.
37
@at-root {
38
  @-ms-viewport { width: device-width; }
39
}
40

41
42
43
44
// Shim for "new" HTML5 structural elements to display correctly (IE10, older browsers)
article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section {
  display: block;
}
45

46
// Body
47
//
48
49
// 1. Remove the margin in all browsers.
// 2. As a best practice, apply a default `background-color`.
50
51
// 3. Set an explicit initial text-align value so that we can later use the
//    the `inherit` value on things like `<th>` elements.
52

Jacob Thornton's avatar
Jacob Thornton committed
53
body {
54
  margin: 0; // 1
Mark Otto's avatar
Mark Otto committed
55
56
  font-family: $font-family-base;
  font-size: $font-size-base;
tomhorvat's avatar
tomhorvat committed
57
  font-weight: $font-weight-base;
Mark Otto's avatar
Mark Otto committed
58
  line-height: $line-height-base;
59
  color: $body-color;
60
  text-align: left; // 3
61
  background-color: $body-bg; // 2
62
63
}

Mark Otto's avatar
Mark Otto committed
64
65
66
67
68
69
70
71
72
// Suppress the focus outline on elements that cannot be accessed via keyboard.
// This prevents an unwanted focus outline from appearing around elements that
// might still respond to pointer events.
//
// Credit: https://github.com/suitcss/base
[tabindex="-1"]:focus {
  outline: none !important;
}

73

74
75
76
77
78
79
80
81
82
83
84
85
// Content grouping
//
// 1. Add the correct box sizing in Firefox.
// 2. Show the overflow in Edge and IE.

hr {
  box-sizing: content-box; // 1
  height: 0; // 1
  overflow: visible; // 2
}


86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//
// Typography
//

// Remove top margins from headings
//
// By default, `<h1>`-`<h6>` all receive top and bottom margins. We nuke the top
// margin for easier control within type scales as it avoids margin collapsing.
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: .5rem;
}

// Reset margins on paragraphs
//
// Similarly, the top margin on `<p>`s get reset. However, we also reset the
// bottom margin to use `rem` units instead of `em`.
p {
  margin-top: 0;
105
  margin-bottom: $paragraph-margin-bottom;
106
107
}

Mark Otto's avatar
Mark Otto committed
108
// Abbreviations
109
110
111
112
113
114
//
// 1. Remove the bottom border in Firefox 39-.
// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
// 3. Add explicit cursor to indicate changed behavior.
// 4. Duplicate behavior to the data-* attribute for our tooltip plugin

115
abbr[title],
116
117
118
119
120
abbr[data-original-title] { // 4
  text-decoration: underline; // 2
  text-decoration: underline dotted; // 2
  cursor: help; // 3
  border-bottom: 0; // 1
121
122
123
124
125
}

address {
  margin-bottom: 1rem;
  font-style: normal;
Mark Otto's avatar
Mark Otto committed
126
  line-height: inherit;
Jacob Thornton's avatar
Jacob Thornton committed
127
128
}

129
130
131
132
133
134
ol,
ul,
dl {
  margin-top: 0;
  margin-bottom: 1rem;
}
135

136
137
138
139
140
141
142
143
ol ol,
ul ul,
ol ul,
ul ol {
  margin-bottom: 0;
}

dt {
144
  font-weight: $dt-font-weight;
145
146
147
148
}

dd {
  margin-bottom: .5rem;
149
  margin-left: 0; // Undo browser default
150
151
152
153
154
155
}

blockquote {
  margin: 0 0 1rem;
}

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
dfn {
  font-style: italic; // Add the correct font style in Android 4.3-
}

b,
strong {
  font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari
}

small {
  font-size: 80%; // Add the correct font size in all browsers
}

//
// Prevent `sub` and `sup` elements from affecting the line height in
// all browsers.
//

sub,
sup {
  position: relative;
  font-size: 75%;
  line-height: 0;
  vertical-align: baseline;
}

sub { bottom: -.25em; }
sup { top: -.5em; }

185
186

//
187
// Links
188
//
Jacob Thornton's avatar
Jacob Thornton committed
189
190

a {
Mark Otto's avatar
Mark Otto committed
191
  color: $link-color;
192
  text-decoration: $link-decoration;
193
194
  background-color: transparent; // Remove the gray background on active links in IE 10.
  -webkit-text-decoration-skip: objects; // Remove gaps in links underline in iOS 8+ and Safari 8+.
Zlatan Vasović's avatar
Zlatan Vasović committed
195

Mark Otto's avatar
Mark Otto committed
196
  @include hover {
Mark Otto's avatar
Mark Otto committed
197
198
    color: $link-hover-color;
    text-decoration: $link-hover-decoration;
Zlatan Vasović's avatar
Zlatan Vasović committed
199
  }
Mark Otto's avatar
Mark Otto committed
200
}
201

202
203
// And undo these styles for placeholder links/named anchors (without href)
// which have not been made explicitly keyboard-focusable (without tabindex).
204
205
206
// It would be more straightforward to just use a[href] in previous block, but that
// causes specificity issues in many other styles that are too complex to fix.
// See https://github.com/twbs/bootstrap/issues/19402
207

208
a:not([href]):not([tabindex]) {
209
210
211
212
213
214
215
216
217
  color: inherit;
  text-decoration: none;

  @include hover-focus {
    color: inherit;
    text-decoration: none;
  }

  &:focus {
218
    outline: 0;
219
220
221
  }
}

222

223
224
225
226
//
// Code
//

227
228
229
230
231
232
233
234
pre,
code,
kbd,
samp {
  font-family: monospace, monospace; // Correct the inheritance and scaling of font size in all browsers.
  font-size: 1em; // Correct the odd `em` font sizing in all browsers.
}

235
236
237
238
239
pre {
  // Remove browser default top margin
  margin-top: 0;
  // Reset browser default of `1em` to use `rem`s
  margin-bottom: 1rem;
240
  // Don't allow content to break outside
Mark Otto's avatar
Mark Otto committed
241
  overflow: auto;
242
243
244
245
246
247
248
249
}


//
// Figures
//

figure {
250
  // Apply a consistent margin strategy (matches our type styles).
251
252
253
254
255
  margin: 0 0 1rem;
}


//
256
// Images and content
257
//
258

Mark Otto's avatar
Mark Otto committed
259
img {
Mark Otto's avatar
Mark Otto committed
260
  vertical-align: middle;
261
262
263
264
265
  border-style: none; // Remove the border on images inside links in IE 10-.
}

svg:not(:root) {
  overflow: hidden; // Hide the overflow in IE
Mark Otto's avatar
Mark Otto committed
266
267
}

268

269
270
271
272
273
274
// Avoid 300ms click delay on touch devices that support the `touch-action` CSS property.
//
// In particular, unlike most other browsers, IE11+Edge on Windows 10 on touch devices and IE Mobile 10-11
// DON'T remove the click delay when `<meta name="viewport" content="width=device-width">` is present.
// However, they DO support removing the click delay via `touch-action: manipulation`.
// See:
275
// * https://getbootstrap.com/docs/4.0/content/reboot/#click-delay-optimization-for-touch
276
// * http://caniuse.com/#feat=css-touch-action
277
// * https://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay
278
279
280
281
282

a,
area,
button,
[role="button"],
283
input:not([type=range]),
284
285
286
287
288
289
290
label,
select,
summary,
textarea {
  touch-action: manipulation;
}

Mark Otto's avatar
spacing    
Mark Otto committed
291

292
293
294
295
296
//
// Tables
//

table {
297
  border-collapse: collapse; // Prevent double borders
298
299
300
301
302
303
304
}

caption {
  padding-top: $table-cell-padding;
  padding-bottom: $table-cell-padding;
  color: $text-muted;
  text-align: left;
305
  caption-side: bottom;
306
307
308
}

th {
309
310
311
  // Matches default `<td>` alignment by inheriting from the `<body>`, or the
  // closest parent with a set `text-align`.
  text-align: inherit;
312
313
314
315
316
317
318
319
}


//
// Forms
//

label {
320
  // Allow labels to use `margin` for spacing.
321
  display: inline-block;
322
  margin-bottom: .5rem;
323
324
}

325
326
327
328
329
330
331
332
333
// Work around a Firefox/IE bug where the transparent `button` background
// results in a loss of the default `button` focus styles.
//
// Credit: https://github.com/suitcss/base/
button:focus {
  outline: 1px dotted;
  outline: 5px auto -webkit-focus-ring-color;
}

334
335
336
input,
button,
select,
337
optgroup,
338
textarea {
339
340
341
  margin: 0; // Remove the margin in Firefox and Safari
  font-family: inherit;
  font-size: inherit;
342
343
344
  line-height: inherit;
}

345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
button,
input {
  overflow: visible; // Show the overflow in Edge
}

button,
select {
  text-transform: none; // Remove the inheritance of text transform in Firefox
}

// 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
//    controls in Android 4.
// 2. Correct the inability to style clickable types in iOS and Safari.
button,
html [type="button"], // 1
[type="reset"],
[type="submit"] {
  -webkit-appearance: button; // 2
}

// Remove inner border and padding from Firefox, but don't restore the outline like Normalize.
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  padding: 0;
  border-style: none;
}

Mark Otto's avatar
Mark Otto committed
374
375
input[type="radio"],
input[type="checkbox"] {
376
377
  box-sizing: border-box; // 1. Add the correct box sizing in IE 10-
  padding: 0; // 2. Remove the padding in IE 10-
Mark Otto's avatar
Mark Otto committed
378
379
380
}


381
382
383
384
385
386
387
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
  // Remove the default appearance of temporal inputs to avoid a Mobile Safari
  // bug where setting a custom line-height prevents text from being vertically
  // centered within the input.
388
389
  // See https://bugs.webkit.org/show_bug.cgi?id=139848
  // and https://github.com/twbs/bootstrap/issues/11266
390
391
392
  -webkit-appearance: listbox;
}

393
textarea {
394
  overflow: auto; // Remove the default vertical scrollbar in IE.
395
396
397
398
399
  // Textareas should really only resize vertically so they don't break their (horizontal) containers.
  resize: vertical;
}

fieldset {
400
401
402
403
404
  // Browsers set a default `min-width: min-content;` on fieldsets,
  // unlike e.g. `<div>`s, which have `min-width: 0;` by default.
  // So we reset that to ensure fieldsets behave more like a standard block element.
  // See https://github.com/twbs/bootstrap/issues/12359
  // and https://html.spec.whatwg.org/multipage/#the-fieldset-and-legend-elements
405
  min-width: 0;
406
407
408
409
  // Reset the default outline behavior of fieldsets so they don't affect page layout.
  padding: 0;
  margin: 0;
  border: 0;
410
411
}

412
413
// 1. Correct the text wrapping in Edge and IE.
// 2. Correct the color inheritance from `fieldset` elements in IE.
414
415
416
legend {
  display: block;
  width: 100%;
417
  max-width: 100%; // 1
418
419
420
421
  padding: 0;
  margin-bottom: .5rem;
  font-size: 1.5rem;
  line-height: inherit;
422
423
424
425
426
427
428
429
430
431
432
433
  color: inherit; // 2
  white-space: normal; // 1
}

progress {
  vertical-align: baseline; // Add the correct vertical alignment in Chrome, Firefox, and Opera.
}

// Correct the cursor style of increment and decrement buttons in Chrome.
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
434
435
}

436
[type="search"] {
437
438
439
440
  // This overrides the extra rounded corners on search inputs in iOS so that our
  // `.form-control` class can properly style them. Note that this cannot simply
  // be added to `.form-control` as it's not specific enough. For details, see
  // https://github.com/twbs/bootstrap/issues/11586.
441
  outline-offset: -2px; // 2. Correct the outline style in Safari.
442
  -webkit-appearance: none;
443
444
}

445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
//
// Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
//

[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

//
// 1. Correct the inability to style clickable types in iOS and Safari.
// 2. Change font properties to `inherit` in Safari.
//

::-webkit-file-upload-button {
  font: inherit; // 2
  -webkit-appearance: button; // 1
}

//
// Correct element displays
//

468
output {
469
  display: inline-block;
470
471
472
473
474
475
476
477
}

summary {
  display: list-item; // Add the correct display in all browsers
}

template {
  display: none; // Add the correct display in IE
478
}
479
480

// Always hide an element with the `hidden` HTML attribute (from PureCSS).
481
// Needed for proper display in IE 10-.
482
483
484
[hidden] {
  display: none !important;
}