_reboot.scss 11.8 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
// Body
22
//
23
// 1. Remove the margin in all browsers.
24
25
26
// 2. As a best practice, apply a default `background-color`.
// 3. Prevent adjustments of font size after orientation changes in IE on Windows Phone and in iOS.
// 4. Change the default tap highlight to be completely transparent in iOS.
Jacob Thornton's avatar
Jacob Thornton committed
27
body {
28
  margin: 0; // 1
Mark Otto's avatar
Mark Otto committed
29
  font-family: $font-family-base;
30
  @include font-size($font-size-base);
tomhorvat's avatar
tomhorvat committed
31
  font-weight: $font-weight-base;
Mark Otto's avatar
Mark Otto committed
32
  line-height: $line-height-base;
33
  color: $body-color;
34
35
36
37
  text-align: $body-text-align;
  background-color: $body-bg; // 2
  -webkit-text-size-adjust: 100%; // 3
  -webkit-tap-highlight-color: rgba($black, 0); // 4
38
39
}

40
41
42
43
44
45
// 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
46
//
47
48
// 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/
Martijn Cuppens's avatar
Martijn Cuppens committed
49

50
[tabindex="-1"]:focus:not(:focus-visible) {
51
  outline: 0 !important;
Mark Otto's avatar
Mark Otto committed
52
53
}

54

55
56
// Content grouping
//
57
58
59
// 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
60
61

hr {
62
63
64
65
66
67
68
69
70
  margin: $hr-margin-y 0;
  color: $hr-color; // 1
  background-color: currentColor;
  border: 0;
  opacity: $hr-opacity;
}

hr:not([size]) {
  height: $hr-height; // 2
71
72
73
}


74
75
// Typography
//
Martijn Cuppens's avatar
Martijn Cuppens committed
76
77
78
// 1. 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.
79

80
%heading {
Martijn Cuppens's avatar
Martijn Cuppens committed
81
  margin-top: 0; // 1
82
  margin-bottom: $headings-margin-bottom;
83
  font-family: $headings-font-family;
84
  font-style: $headings-font-style;
85
86
87
  font-weight: $headings-font-weight;
  line-height: $headings-line-height;
  color: $headings-color;
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
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);
}


121
122
123
124
// 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`.
Martijn Cuppens's avatar
Martijn Cuppens committed
125

126
127
p {
  margin-top: 0;
128
  margin-bottom: $paragraph-margin-bottom;
129
130
}

Martijn Cuppens's avatar
Martijn Cuppens committed
131

Mark Otto's avatar
Mark Otto committed
132
// Abbreviations
133
//
134
// 1. Duplicate behavior to the data-* attribute for our tooltip plugin
135
136
// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
// 3. Add explicit cursor to indicate changed behavior.
Martijn Cuppens's avatar
Martijn Cuppens committed
137
// 4. Prevent the text-decoration to be skipped.
138

139
abbr[title],
140
abbr[data-original-title] { // 1
141
142
143
  text-decoration: underline; // 2
  text-decoration: underline dotted; // 2
  cursor: help; // 3
Martijn Cuppens's avatar
Martijn Cuppens committed
144
  text-decoration-skip-ink: none; // 4
145
146
}

Martijn Cuppens's avatar
Martijn Cuppens committed
147

148
149
150
address {
  margin-bottom: 1rem;
  font-style: normal;
Mark Otto's avatar
Mark Otto committed
151
  line-height: inherit;
Jacob Thornton's avatar
Jacob Thornton committed
152
153
}

Mark Otto's avatar
Mark Otto committed
154
155
156
157
158
ol,
ul {
  padding-left: 2rem;
}

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
}

Martijn Cuppens's avatar
Martijn Cuppens committed
177
178
// 1. Undo browser default

179
180
dd {
  margin-bottom: .5rem;
Martijn Cuppens's avatar
Martijn Cuppens committed
181
  margin-left: 0; // 1
182
183
184
185
186
187
}

blockquote {
  margin: 0 0 1rem;
}

Martijn Cuppens's avatar
Martijn Cuppens committed
188
189
// Add the correct font weight in Chrome, Edge, and Safari

190
191
b,
strong {
Martijn Cuppens's avatar
Martijn Cuppens committed
192
  font-weight: $font-weight-bolder;
193
194
}

Martijn Cuppens's avatar
Martijn Cuppens committed
195
196
197

// Add the correct font size in all browsers

198
small {
Martijn Cuppens's avatar
Martijn Cuppens committed
199
  @include font-size($small-font-size);
200
201
202
203
204
205
206
207
}

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

sub,
sup {
  position: relative;
208
  @include font-size(75%);
209
210
211
212
213
214
215
  line-height: 0;
  vertical-align: baseline;
}

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

216

217
// Links
Jacob Thornton's avatar
Jacob Thornton committed
218
219

a {
Mark Otto's avatar
Mark Otto committed
220
  color: $link-color;
221
  text-decoration: $link-decoration;
Zlatan Vasović's avatar
Zlatan Vasović committed
222

Mark Otto's avatar
Mark Otto committed
223
  &:hover {
Mark Otto's avatar
Mark Otto committed
224
225
    color: $link-hover-color;
    text-decoration: $link-hover-decoration;
Zlatan Vasović's avatar
Zlatan Vasović committed
226
  }
Mark Otto's avatar
Mark Otto committed
227
}
228

229
// And undo these styles for placeholder links/named anchors (without href).
230
231
232
// 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
233

234
a:not([href]) {
Mark Otto's avatar
Mark Otto committed
235
  &,
236
  &:hover {
237
238
239
240
241
    color: inherit;
    text-decoration: none;
  }
}

242

243
244
// Code

245
246
247
248
pre,
code,
kbd,
samp {
249
  font-family: $font-family-monospace;
250
  @include font-size(1em); // Correct the odd `em` font sizing in all browsers.
251
252
}

Martijn Cuppens's avatar
Martijn Cuppens committed
253
254
255
256
// 1. Remove browser default top margin
// 2. Reset browser default of `1em` to use `rem`s
// 3. Don't allow content to break outside

257
pre {
Martijn Cuppens's avatar
Martijn Cuppens committed
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
  display: block;
  margin-top: 0; // 1
  margin-bottom: 1rem; // 2
  overflow: auto; // 3
  @include font-size($code-font-size);
  color: $pre-color;

  // Account for some code outputs that place code tags in pre tags
  code {
    @include font-size(inherit);
    color: inherit;
    word-break: normal;
  }
}

code {
  @include font-size($code-font-size);
  color: $code-color;
  word-wrap: break-word;

  // Streamline the style when inside anchors to avoid broken underline and more
  a > & {
    color: inherit;
  }
}

kbd {
  padding: $kbd-padding-y $kbd-padding-x;
  @include font-size($kbd-font-size);
  color: $kbd-color;
  background-color: $kbd-bg;
  @include border-radius($border-radius-sm);

  kbd {
    padding: 0;
    @include font-size(100%);
    font-weight: $nested-kbd-font-weight;
  }
296
297
298
299
}


// Figures
Martijn Cuppens's avatar
Martijn Cuppens committed
300
301

// Apply a consistent margin strategy (matches our type styles).
302
303
304
305
306
307

figure {
  margin: 0 0 1rem;
}


308
// Images and content
309

Mark Otto's avatar
Mark Otto committed
310
img {
Mark Otto's avatar
Mark Otto committed
311
  vertical-align: middle;
312
313
}

Martijn Cuppens's avatar
Martijn Cuppens committed
314
315
316
// 1. Workaround for the SVG overflow bug in IE 11 is still required.
//    See https://github.com/twbs/bootstrap/issues/26878

317
svg {
Martijn Cuppens's avatar
Martijn Cuppens committed
318
  overflow: hidden; // 1
ysds's avatar
ysds committed
319
  vertical-align: middle;
Mark Otto's avatar
Mark Otto committed
320
321
}

322

323
// Tables
Martijn Cuppens's avatar
Martijn Cuppens committed
324
325

// Prevent double borders
326
327

table {
Martijn Cuppens's avatar
Martijn Cuppens committed
328
  border-collapse: collapse;
329
330
331
332
333
}

caption {
  padding-top: $table-cell-padding;
  padding-bottom: $table-cell-padding;
334
  color: $table-caption-color;
335
  text-align: left;
336
  caption-side: bottom;
337
338
}

Martijn Cuppens's avatar
Martijn Cuppens committed
339
340
341
// Matches default `<td>` alignment by inheriting from the `<body>`, or the
// closest parent with a set `text-align`.

342
th {
343
  text-align: inherit;
344
345
346
347
}


// Forms
Martijn Cuppens's avatar
Martijn Cuppens committed
348
349

// 1. Allow labels to use `margin` for spacing.
350
351

label {
Martijn Cuppens's avatar
Martijn Cuppens committed
352
  display: inline-block; // 1
353
  margin-bottom: $label-margin-bottom;
354
355
}

356
357
358
// Remove the default `border-radius` that macOS Chrome adds.
//
// Details at https://github.com/twbs/bootstrap/issues/24093
Martijn Cuppens's avatar
Martijn Cuppens committed
359

360
button {
361
  // stylelint-disable-next-line property-blacklist
362
363
364
  border-radius: 0;
}

365
366
367
368
// 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/
Martijn Cuppens's avatar
Martijn Cuppens committed
369

370
371
372
373
374
button:focus {
  outline: 1px dotted;
  outline: 5px auto -webkit-focus-ring-color;
}

Martijn Cuppens's avatar
Martijn Cuppens committed
375
376
// 1. Remove the margin in Firefox and Safari

377
378
379
input,
button,
select,
380
optgroup,
381
textarea {
Martijn Cuppens's avatar
Martijn Cuppens committed
382
  margin: 0;
383
  font-family: inherit;
384
  @include font-size(inherit);
385
386
387
  line-height: inherit;
}

Martijn Cuppens's avatar
Martijn Cuppens committed
388
389
// Show the overflow in Edge

390
391
button,
input {
Martijn Cuppens's avatar
Martijn Cuppens committed
392
  overflow: visible;
393
394
}

Martijn Cuppens's avatar
Martijn Cuppens committed
395
396
// Remove the inheritance of text transform in Firefox

397
398
button,
select {
Martijn Cuppens's avatar
Martijn Cuppens committed
399
  text-transform: none;
400
401
}

402
403
404
// Remove the inheritance of word-wrap in Safari.
//
// Details at https://github.com/twbs/bootstrap/issues/24990
Martijn Cuppens's avatar
Martijn Cuppens committed
405

406
407
408
409
410
select {
  word-wrap: normal;
}


411
412
413
// 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.
Martijn Cuppens's avatar
Martijn Cuppens committed
414
415
// 3. Opinionated: add "hand" cursor to non-disabled button elements.

416
button,
417
[type="button"], // 1
418
419
420
421
[type="reset"],
[type="submit"] {
  -webkit-appearance: button; // 2

Martijn Cuppens's avatar
Martijn Cuppens committed
422
  @if $enable-pointer-cursor-for-buttons {
423
    &:not(:disabled) {
Martijn Cuppens's avatar
Martijn Cuppens committed
424
      cursor: pointer; // 3
425
426
427
428
    }
  }
}

Martijn Cuppens's avatar
Martijn Cuppens committed
429

430
// Remove inner border and padding from Firefox, but don't restore the outline like Normalize.
Martijn Cuppens's avatar
Martijn Cuppens committed
431
432

::-moz-focus-inner {
433
434
435
436
  padding: 0;
  border-style: none;
}

Mark Otto's avatar
Mark Otto committed
437

Martijn Cuppens's avatar
Martijn Cuppens committed
438
439
440
441
442
// 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.
// See https://bugs.webkit.org/show_bug.cgi?id=139848
// and https://github.com/twbs/bootstrap/issues/11266
Mark Otto's avatar
Mark Otto committed
443

444
445
446
447
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
Martijn Cuppens's avatar
Martijn Cuppens committed
448
  -webkit-appearance: textfield;
449
450
}

Martijn Cuppens's avatar
Martijn Cuppens committed
451
452
453
454
// 1. Remove the default vertical scrollbar in IE.
// 2. Textareas should really only resize vertically so they don't break their (horizontal) containers.
// 3. Use the same borders as textfields

455
textarea {
Martijn Cuppens's avatar
Martijn Cuppens committed
456
457
458
  overflow: auto; // 1
  resize: vertical;  // 2
  -webkit-appearance: textfield; // 3
459
460
}

Martijn Cuppens's avatar
Martijn Cuppens committed
461
462
463
464
465
466
467
// 1. 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
// 2. Reset the default outline behavior of fieldsets so they don't affect page layout.

468
fieldset {
Martijn Cuppens's avatar
Martijn Cuppens committed
469
470
471
472
  min-width: 0; // 1
  padding: 0;  // 2
  margin: 0; // 2
  border: 0; // 2
473
474
}

Martijn Cuppens's avatar
Martijn Cuppens committed
475
476

// 1. By using `float: left`, the legend will behave like a block element
477
// 2. Correct the color inheritance from `fieldset` elements in IE.
Martijn Cuppens's avatar
Martijn Cuppens committed
478
479
// 3. Correct the text wrapping in Edge and IE.

480
legend {
Martijn Cuppens's avatar
Martijn Cuppens committed
481
  float: left; // 1
482
483
  width: 100%;
  padding: 0;
Martijn Cuppens's avatar
Martijn Cuppens committed
484
485
486
  margin-bottom: $legend-margin-bottom;
  @include font-size($legend-font-size);
  font-weight: $legend-font-weight;
487
  line-height: inherit;
488
  color: inherit; // 2
Martijn Cuppens's avatar
Martijn Cuppens committed
489
  white-space: normal; // 3
490
491
}

Martijn Cuppens's avatar
Martijn Cuppens committed
492

493
494
495
496
497
mark {
  padding: $mark-padding;
  background-color: $mark-bg;
}

Martijn Cuppens's avatar
Martijn Cuppens committed
498
499
// Add the correct vertical alignment in Chrome, Firefox, and Opera.

500
progress {
Martijn Cuppens's avatar
Martijn Cuppens committed
501
  vertical-align: baseline;
502
503
}

Martijn Cuppens's avatar
Martijn Cuppens committed
504
505
506
507

// Fix height of inputs with a type of datetime-local, date, month, week, or time
// See https://github.com/twbs/bootstrap/issues/18842

Martijn Cuppens's avatar
Martijn Cuppens committed
508
509
510
::-webkit-datetime-edit {
  overflow: visible;
  line-height: 0;
511
512
}

Martijn Cuppens's avatar
Martijn Cuppens committed
513
514
515
516
517
518
519

// 1. Correct the outline style in Safari.
// 2. 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.

520
[type="search"] {
Martijn Cuppens's avatar
Martijn Cuppens committed
521
522
  outline-offset: -2px; // 1
  -webkit-appearance: textfield; // 2
523
524
}

XhmikosR's avatar
XhmikosR committed
525
// Remove the inner padding in Chrome and Safari on macOS.
526

Martijn Cuppens's avatar
Martijn Cuppens committed
527
::-webkit-search-decoration {
528
529
530
  -webkit-appearance: none;
}

Martijn Cuppens's avatar
Martijn Cuppens committed
531
532
// 1. Change font properties to `inherit` in Safari.
// 2. Correct the inability to style clickable types in iOS and Safari.
533
534

::-webkit-file-upload-button {
Martijn Cuppens's avatar
Martijn Cuppens committed
535
536
  font: inherit; // 1
  -webkit-appearance: button; // 2
537
538
539
540
}

// Correct element displays

541
output {
542
  display: inline-block;
543
544
}

Martijn Cuppens's avatar
Martijn Cuppens committed
545
546
// 1. Add the correct display in all browsers

547
summary {
Martijn Cuppens's avatar
Martijn Cuppens committed
548
  display: list-item; // 1
549
  cursor: pointer;
550
551
}

Martijn Cuppens's avatar
Martijn Cuppens committed
552
553
// Add the correct display for template & main in IE 11

554
template {
Martijn Cuppens's avatar
Martijn Cuppens committed
555
  display: none;
556
}
557

Martijn Cuppens's avatar
Martijn Cuppens committed
558
559
560
561
562
563
main {
  display: block;
}

// Always hide an element with the `hidden` HTML attribute.

564
565
566
[hidden] {
  display: none !important;
}