_reboot.scss 11.7 KB
Newer Older
1
// stylelint-disable at-rule-no-vendor-prefix, declaration-no-important, selector-no-qualifying-type, property-no-vendor-prefix
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
// Change from `box-sizing: content-box` so that `width` is not affected by `padding` or `border`.
14
15
16
*,
*::before,
*::after {
17
  box-sizing: border-box;
18
}
19

20
21
// Shim for IE11
main {
22
23
  display: block;
}
24

25
// Body
26
//
27
// 1. Remove the margin in all browsers.
28
// 2. Set an explicit initial text-align value so that we can later use
29
//    the `inherit` value on things like `<th>` elements.
30
31
32
// 3. As a best practice, apply a default `background-color`.
// 4. Prevent adjustments of font size after orientation changes in IE on Windows Phone and in iOS.
// 5. Change the default tap highlight to be completely transparent in iOS.
Jacob Thornton's avatar
Jacob Thornton committed
33
body {
34
  margin: 0; // 1
Mark Otto's avatar
Mark Otto committed
35
  font-family: $font-family-base;
36
  @include font-size($font-size-base);
tomhorvat's avatar
tomhorvat committed
37
  font-weight: $font-weight-base;
Mark Otto's avatar
Mark Otto committed
38
  line-height: $line-height-base;
39
  color: $body-color;
40
41
42
43
  text-align: left; // 2
  background-color: $body-bg; // 3
  -webkit-text-size-adjust: 100%; // 4
  -webkit-tap-highlight-color: rgba($black, 0); // 5
44
45
}

46
47
48
49
50
51
// Future-proof rule: in browsers that support :focus-visible, suppress the focus outline
// on elements that programmatically receive focus but wouldn't normally show a visible
// focus outline. In general, this would mean that the outline is only applied if the
// interaction that led to the element receiving programmatic focus was a keyboard interaction,
// or the browser has somehow determined that the user is primarily a keyboard user and/or
// wants focus outlines to always be presented.
Mark Otto's avatar
Mark Otto committed
52
//
53
54
55
// See https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible
// and https://developer.paciellogroup.com/blog/2018/03/focus-visible-and-backwards-compatibility/
[tabindex="-1"]:focus:not(:focus-visible) {
56
  outline: 0 !important;
Mark Otto's avatar
Mark Otto committed
57
58
}

59

60
61
// Content grouping
//
62
63
64
// 1. Reset Firefox's gray color
// 2. Set correct height and prevent the `size` attribute to make the `hr` look like an input field
//    See https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_hr_size
65
66

hr {
67
68
69
70
71
72
73
74
75
  margin: $hr-margin-y 0;
  color: $hr-color; // 1
  background-color: currentColor;
  border: 0;
  opacity: $hr-opacity;
}

hr:not([size]) {
  height: $hr-height; // 2
76
77
78
}


79
80
81
82
83
84
85
86
//
// 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.
87
%heading {
88
  margin-top: 0;
89
  margin-bottom: $headings-margin-bottom;
90
91
92
93
  font-family: $headings-font-family;
  font-weight: $headings-font-weight;
  line-height: $headings-line-height;
  color: $headings-color;
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
h1 {
  @extend %heading;
  @include font-size($h1-font-size);
}

h2 {
  @extend %heading;
  @include font-size($h2-font-size);
}

h3 {
  @extend %heading;
  @include font-size($h3-font-size);
}

h4 {
  @extend %heading;
  @include font-size($h4-font-size);
}

h5 {
  @extend %heading;
  @include font-size($h5-font-size);
}

h6 {
  @extend %heading;
  @include font-size($h6-font-size);
}


127
128
129
130
131
132
// 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;
133
  margin-bottom: $paragraph-margin-bottom;
134
135
}

Mark Otto's avatar
Mark Otto committed
136
// Abbreviations
137
//
138
// 1. Duplicate behavior to the data-* attribute for our tooltip plugin
139
140
// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
// 3. Add explicit cursor to indicate changed behavior.
141
142
// 4. Remove the bottom border in Firefox 39-.
// 5. Prevent the text-decoration to be skipped.
143

144
abbr[title],
145
abbr[data-original-title] { // 1
146
147
148
  text-decoration: underline; // 2
  text-decoration: underline dotted; // 2
  cursor: help; // 3
149
150
  border-bottom: 0; // 4
  text-decoration-skip-ink: none; // 5
151
152
153
154
155
}

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

159
160
161
162
163
164
ol,
ul,
dl {
  margin-top: 0;
  margin-bottom: 1rem;
}
165

166
167
168
169
170
171
172
173
ol ol,
ul ul,
ol ul,
ul ol {
  margin-bottom: 0;
}

dt {
174
  font-weight: $dt-font-weight;
175
176
177
178
}

dd {
  margin-bottom: .5rem;
179
  margin-left: 0; // Undo browser default
180
181
182
183
184
185
}

blockquote {
  margin: 0 0 1rem;
}

186
187
b,
strong {
188
  font-weight: $font-weight-bolder; // Add the correct font weight in Chrome, Edge, and Safari
189
190
191
}

small {
192
  @include font-size($small-font-size); // Add the correct font size in all browsers
193
194
195
196
197
198
199
200
201
202
}

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

sub,
sup {
  position: relative;
203
  @include font-size(75%);
204
205
206
207
208
209
210
  line-height: 0;
  vertical-align: baseline;
}

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

211
212

//
213
// Links
214
//
Jacob Thornton's avatar
Jacob Thornton committed
215
216

a {
Mark Otto's avatar
Mark Otto committed
217
  color: $link-color;
218
  text-decoration: $link-decoration;
219
  background-color: transparent; // Remove the gray background on active links in IE 10.
Zlatan Vasović's avatar
Zlatan Vasović committed
220

Mark Otto's avatar
Mark Otto committed
221
  @include hover {
Mark Otto's avatar
Mark Otto committed
222
223
    color: $link-hover-color;
    text-decoration: $link-hover-decoration;
Zlatan Vasović's avatar
Zlatan Vasović committed
224
  }
Mark Otto's avatar
Mark Otto committed
225
}
226

227
228
// And undo these styles for placeholder links/named anchors (without href)
// which have not been made explicitly keyboard-focusable (without tabindex).
229
230
231
// 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
232

233
a:not([href]):not([tabindex]) {
234
235
236
237
238
239
240
241
242
  color: inherit;
  text-decoration: none;

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

  &:focus {
243
    outline: 0;
244
245
246
  }
}

247

248
249
250
251
//
// Code
//

252
253
254
255
pre,
code,
kbd,
samp {
256
  font-family: $font-family-monospace;
257
  @include font-size(1em); // Correct the odd `em` font sizing in all browsers.
258
259
}

260
261
262
263
264
pre {
  // Remove browser default top margin
  margin-top: 0;
  // Reset browser default of `1em` to use `rem`s
  margin-bottom: 1rem;
265
  // Don't allow content to break outside
Mark Otto's avatar
Mark Otto committed
266
  overflow: auto;
267
268
269
270
271
272
273
274
}


//
// Figures
//

figure {
275
  // Apply a consistent margin strategy (matches our type styles).
276
277
278
279
280
  margin: 0 0 1rem;
}


//
281
// Images and content
282
//
283

Mark Otto's avatar
Mark Otto committed
284
img {
Mark Otto's avatar
Mark Otto committed
285
  vertical-align: middle;
286
287
288
  border-style: none; // Remove the border on images inside links in IE 10-.
}

289
svg {
290
291
292
  // Workaround for the SVG overflow bug in IE10/11 is still required.
  // See https://github.com/twbs/bootstrap/issues/26878
  overflow: hidden;
ysds's avatar
ysds committed
293
  vertical-align: middle;
Mark Otto's avatar
Mark Otto committed
294
295
}

296

297
298
299
300
301
//
// Tables
//

table {
302
  border-collapse: collapse; // Prevent double borders
303
304
305
306
307
}

caption {
  padding-top: $table-cell-padding;
  padding-bottom: $table-cell-padding;
308
  color: $table-caption-color;
309
  text-align: left;
310
  caption-side: bottom;
311
312
313
}

th {
314
315
316
  // Matches default `<td>` alignment by inheriting from the `<body>`, or the
  // closest parent with a set `text-align`.
  text-align: inherit;
317
318
319
320
321
322
323
324
}


//
// Forms
//

label {
325
  // Allow labels to use `margin` for spacing.
326
  display: inline-block;
327
  margin-bottom: $label-margin-bottom;
328
329
}

330
331
332
333
// Remove the default `border-radius` that macOS Chrome adds.
//
// Details at https://github.com/twbs/bootstrap/issues/24093
button {
334
  // stylelint-disable-next-line property-blacklist
335
336
337
  border-radius: 0;
}

338
339
340
341
342
343
344
345
346
// 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;
}

347
348
349
input,
button,
select,
350
optgroup,
351
textarea {
352
353
  margin: 0; // Remove the margin in Firefox and Safari
  font-family: inherit;
354
  @include font-size(inherit);
355
356
357
  line-height: inherit;
}

358
359
360
361
362
363
364
365
366
367
button,
input {
  overflow: visible; // Show the overflow in Edge
}

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

368
369
370
371
372
373
374
375
// Remove the inheritance of word-wrap in Safari.
//
// Details at https://github.com/twbs/bootstrap/issues/24990
select {
  word-wrap: normal;
}


376
377
378
379
// 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,
380
[type="button"], // 1
381
382
383
384
385
[type="reset"],
[type="submit"] {
  -webkit-appearance: button; // 2
}

386
387
388
389
390
391
392
393
394
395
396
397
// Opinionated: add "hand" cursor to non-disabled button elements.
@if $enable-pointer-cursor-for-buttons {
  button,
  [type="button"],
  [type="reset"],
  [type="submit"] {
    &:not(:disabled) {
      cursor: pointer;
    }
  }
}

398
399
400
401
402
403
404
405
406
// 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
407
408
input[type="radio"],
input[type="checkbox"] {
409
410
  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
411
412
413
}


414
415
416
417
418
419
420
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.
421
422
  // See https://bugs.webkit.org/show_bug.cgi?id=139848
  // and https://github.com/twbs/bootstrap/issues/11266
423
424
425
  -webkit-appearance: listbox;
}

426
textarea {
427
  overflow: auto; // Remove the default vertical scrollbar in IE.
428
429
430
431
432
  // Textareas should really only resize vertically so they don't break their (horizontal) containers.
  resize: vertical;
}

fieldset {
433
434
435
436
437
  // 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
438
  min-width: 0;
439
440
441
442
  // Reset the default outline behavior of fieldsets so they don't affect page layout.
  padding: 0;
  margin: 0;
  border: 0;
443
444
}

445
446
// 1. Correct the text wrapping in Edge and IE.
// 2. Correct the color inheritance from `fieldset` elements in IE.
447
448
449
legend {
  display: block;
  width: 100%;
450
  max-width: 100%; // 1
451
452
  padding: 0;
  margin-bottom: .5rem;
453
  @include font-size(1.5rem);
454
  line-height: inherit;
455
456
457
458
  color: inherit; // 2
  white-space: normal; // 1
}

459
460
461
462
463
mark {
  padding: $mark-padding;
  background-color: $mark-bg;
}

464
465
466
467
468
469
470
471
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;
472
473
}

474
[type="search"] {
475
476
477
478
  // 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.
479
  outline-offset: -2px; // 2. Correct the outline style in Safari.
480
  -webkit-appearance: none;
481
482
}

483
//
XhmikosR's avatar
XhmikosR committed
484
// Remove the inner padding in Chrome and Safari on macOS.
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
//

[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
//

505
output {
506
  display: inline-block;
507
508
509
510
}

summary {
  display: list-item; // Add the correct display in all browsers
511
  cursor: pointer;
512
513
514
515
}

template {
  display: none; // Add the correct display in IE
516
}
517
518

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