_reboot.scss 12.3 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
22
23
24
25
26
27
// Root
//
// 1. Ability to the value of the root font sizes, affecting the value of `rem`.
//    null by default, thus nothing is generated.

:root {
  font-size: $font-size-root; // 1
}
28

29
// Body
30
//
31
// 1. Remove the margin in all browsers.
32
33
34
// 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
35
body {
36
  margin: 0; // 1
Mark Otto's avatar
Mark Otto committed
37
  font-family: $font-family-base;
38
  @include font-size($font-size-base);
tomhorvat's avatar
tomhorvat committed
39
  font-weight: $font-weight-base;
Mark Otto's avatar
Mark Otto committed
40
  line-height: $line-height-base;
41
  color: $body-color;
42
43
44
45
  text-align: $body-text-align;
  background-color: $body-bg; // 2
  -webkit-text-size-adjust: 100%; // 3
  -webkit-tap-highlight-color: rgba($black, 0); // 4
46
47
}

48
49
50
51
52
53
// 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
54
//
55
56
// 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
57

58
[tabindex="-1"]:focus:not(:focus-visible) {
59
  outline: 0 !important;
Mark Otto's avatar
Mark Otto committed
60
61
}

62

63
64
// Content grouping
//
65
66
67
// 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
68
69

hr {
70
71
72
73
74
75
76
77
78
  margin: $hr-margin-y 0;
  color: $hr-color; // 1
  background-color: currentColor;
  border: 0;
  opacity: $hr-opacity;
}

hr:not([size]) {
  height: $hr-height; // 2
79
80
81
}


82
83
// Typography
//
Martijn Cuppens's avatar
Martijn Cuppens committed
84
85
86
// 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.
87

88
%heading {
Martijn Cuppens's avatar
Martijn Cuppens committed
89
  margin-top: 0; // 1
90
  margin-bottom: $headings-margin-bottom;
91
  font-family: $headings-font-family;
92
  font-style: $headings-font-style;
93
94
95
  font-weight: $headings-font-weight;
  line-height: $headings-line-height;
  color: $headings-color;
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
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);
}


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`.
Martijn Cuppens's avatar
Martijn Cuppens committed
133

134
135
p {
  margin-top: 0;
136
  margin-bottom: $paragraph-margin-bottom;
137
138
}

Martijn Cuppens's avatar
Martijn Cuppens committed
139

Mark Otto's avatar
Mark Otto committed
140
// Abbreviations
141
//
142
// 1. Duplicate behavior to the data-* attribute for our tooltip plugin
143
144
// 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
145
// 4. Prevent the text-decoration to be skipped.
146

147
abbr[title],
148
abbr[data-original-title] { // 1
149
150
151
  text-decoration: underline; // 2
  text-decoration: underline dotted; // 2
  cursor: help; // 3
Martijn Cuppens's avatar
Martijn Cuppens committed
152
  text-decoration-skip-ink: none; // 4
153
154
}

Martijn Cuppens's avatar
Martijn Cuppens committed
155

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

Mark Otto's avatar
Mark Otto committed
162
163
164
165
166
ol,
ul {
  padding-left: 2rem;
}

167
168
169
170
171
172
ol,
ul,
dl {
  margin-top: 0;
  margin-bottom: 1rem;
}
173

174
175
176
177
178
179
180
181
ol ol,
ul ul,
ol ul,
ul ol {
  margin-bottom: 0;
}

dt {
182
  font-weight: $dt-font-weight;
183
184
}

Martijn Cuppens's avatar
Martijn Cuppens committed
185
186
// 1. Undo browser default

187
188
dd {
  margin-bottom: .5rem;
Martijn Cuppens's avatar
Martijn Cuppens committed
189
  margin-left: 0; // 1
190
191
192
193
194
195
}

blockquote {
  margin: 0 0 1rem;
}

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

198
199
b,
strong {
Martijn Cuppens's avatar
Martijn Cuppens committed
200
  font-weight: $font-weight-bolder;
201
202
}

Martijn Cuppens's avatar
Martijn Cuppens committed
203
204
205

// Add the correct font size in all browsers

206
small {
Martijn Cuppens's avatar
Martijn Cuppens committed
207
  @include font-size($small-font-size);
208
209
210
211
212
213
214
215
}

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

sub,
sup {
  position: relative;
216
  @include font-size($sub-sup-font-size);
217
218
219
220
221
222
223
  line-height: 0;
  vertical-align: baseline;
}

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

224

225
// Links
Jacob Thornton's avatar
Jacob Thornton committed
226
227

a {
Mark Otto's avatar
Mark Otto committed
228
  color: $link-color;
229
  text-decoration: $link-decoration;
Zlatan Vasović's avatar
Zlatan Vasović committed
230

Mark Otto's avatar
Mark Otto committed
231
  &:hover {
Mark Otto's avatar
Mark Otto committed
232
233
    color: $link-hover-color;
    text-decoration: $link-hover-decoration;
Zlatan Vasović's avatar
Zlatan Vasović committed
234
  }
Mark Otto's avatar
Mark Otto committed
235
}
236

237
// And undo these styles for placeholder links/named anchors (without href).
238
239
240
// 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
241

242
a:not([href]) {
Mark Otto's avatar
Mark Otto committed
243
  &,
244
  &:hover {
245
246
247
248
249
    color: inherit;
    text-decoration: none;
  }
}

250

251
252
// Code

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

Martijn Cuppens's avatar
Martijn Cuppens committed
261
262
263
264
// 1. Remove browser default top margin
// 2. Reset browser default of `1em` to use `rem`s
// 3. Don't allow content to break outside

265
pre {
Martijn Cuppens's avatar
Martijn Cuppens committed
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
299
300
  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;
301
    @include font-size(1em);
Martijn Cuppens's avatar
Martijn Cuppens committed
302
303
    font-weight: $nested-kbd-font-weight;
  }
304
305
306
307
}


// Figures
Martijn Cuppens's avatar
Martijn Cuppens committed
308
309

// Apply a consistent margin strategy (matches our type styles).
310
311
312
313
314
315

figure {
  margin: 0 0 1rem;
}


316
// Images and content
317

Mark Otto's avatar
Mark Otto committed
318
img {
Mark Otto's avatar
Mark Otto committed
319
  vertical-align: middle;
320
321
}

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

325
svg {
Martijn Cuppens's avatar
Martijn Cuppens committed
326
  overflow: hidden; // 1
ysds's avatar
ysds committed
327
  vertical-align: middle;
Mark Otto's avatar
Mark Otto committed
328
329
}

330

331
// Tables
Martijn Cuppens's avatar
Martijn Cuppens committed
332
333

// Prevent double borders
334
335

table {
Martijn Cuppens's avatar
Martijn Cuppens committed
336
  border-collapse: collapse;
337
338
339
340
341
}

caption {
  padding-top: $table-cell-padding;
  padding-bottom: $table-cell-padding;
342
  color: $table-caption-color;
343
  text-align: left;
344
  caption-side: bottom;
345
346
}

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

350
th {
351
  text-align: inherit;
352
353
354
355
}


// Forms
Martijn Cuppens's avatar
Martijn Cuppens committed
356
357

// 1. Allow labels to use `margin` for spacing.
358
359

label {
Martijn Cuppens's avatar
Martijn Cuppens committed
360
  display: inline-block; // 1
361
  margin-bottom: $label-margin-bottom;
362
363
}

364
365
366
// 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
367

368
button {
369
  // stylelint-disable-next-line property-blacklist
370
371
372
  border-radius: 0;
}

373
374
375
376
// 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
377

378
379
380
381
382
button:focus {
  outline: 1px dotted;
  outline: 5px auto -webkit-focus-ring-color;
}

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

385
386
387
input,
button,
select,
388
optgroup,
389
textarea {
Martijn Cuppens's avatar
Martijn Cuppens committed
390
  margin: 0;
391
  font-family: inherit;
392
  @include font-size(inherit);
393
394
395
  line-height: inherit;
}

Martijn Cuppens's avatar
Martijn Cuppens committed
396
397
// Show the overflow in Edge

398
399
button,
input {
Martijn Cuppens's avatar
Martijn Cuppens committed
400
  overflow: visible;
401
402
}

Martijn Cuppens's avatar
Martijn Cuppens committed
403
404
// Remove the inheritance of text transform in Firefox

405
406
button,
select {
Martijn Cuppens's avatar
Martijn Cuppens committed
407
  text-transform: none;
408
409
}

410
411
412
// Remove the inheritance of word-wrap in Safari.
//
// Details at https://github.com/twbs/bootstrap/issues/24990
Martijn Cuppens's avatar
Martijn Cuppens committed
413

414
415
416
417
select {
  word-wrap: normal;
}

418
419
420
421
422
423
424
// Remove the dropdown arrow in Chrome from inputs built with datalists.
//
// Source: https://stackoverflow.com/a/54997118

[list]::-webkit-calendar-picker-indicator {
  display: none;
}
425

426
427
428
// 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
429
430
// 3. Opinionated: add "hand" cursor to non-disabled button elements.

431
button,
432
[type="button"], // 1
433
434
435
436
[type="reset"],
[type="submit"] {
  -webkit-appearance: button; // 2

Martijn Cuppens's avatar
Martijn Cuppens committed
437
  @if $enable-pointer-cursor-for-buttons {
438
    &:not(:disabled) {
Martijn Cuppens's avatar
Martijn Cuppens committed
439
      cursor: pointer; // 3
440
441
442
443
    }
  }
}

Martijn Cuppens's avatar
Martijn Cuppens committed
444

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

::-moz-focus-inner {
448
449
450
451
  padding: 0;
  border-style: none;
}

Mark Otto's avatar
Mark Otto committed
452

Martijn Cuppens's avatar
Martijn Cuppens committed
453
454
455
456
457
// 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
458

459
460
461
462
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
Martijn Cuppens's avatar
Martijn Cuppens committed
463
  -webkit-appearance: textfield;
464
465
}

Martijn Cuppens's avatar
Martijn Cuppens committed
466
467
468
469
// 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

470
textarea {
Martijn Cuppens's avatar
Martijn Cuppens committed
471
472
473
  overflow: auto; // 1
  resize: vertical;  // 2
  -webkit-appearance: textfield; // 3
474
475
}

Martijn Cuppens's avatar
Martijn Cuppens committed
476
477
478
479
480
481
482
// 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.

483
fieldset {
Martijn Cuppens's avatar
Martijn Cuppens committed
484
485
486
487
  min-width: 0; // 1
  padding: 0;  // 2
  margin: 0; // 2
  border: 0; // 2
488
489
}

Martijn Cuppens's avatar
Martijn Cuppens committed
490
491

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

495
legend {
Martijn Cuppens's avatar
Martijn Cuppens committed
496
  float: left; // 1
497
498
  width: 100%;
  padding: 0;
Martijn Cuppens's avatar
Martijn Cuppens committed
499
500
501
  margin-bottom: $legend-margin-bottom;
  @include font-size($legend-font-size);
  font-weight: $legend-font-weight;
502
  line-height: inherit;
503
  color: inherit; // 2
Martijn Cuppens's avatar
Martijn Cuppens committed
504
  white-space: normal; // 3
505
506
}

Martijn Cuppens's avatar
Martijn Cuppens committed
507

508
509
510
511
512
mark {
  padding: $mark-padding;
  background-color: $mark-bg;
}

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

515
progress {
Martijn Cuppens's avatar
Martijn Cuppens committed
516
  vertical-align: baseline;
517
518
}

Martijn Cuppens's avatar
Martijn Cuppens committed
519
520
521
522

// 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
523
524
525
::-webkit-datetime-edit {
  overflow: visible;
  line-height: 0;
526
527
}

Martijn Cuppens's avatar
Martijn Cuppens committed
528
529
530
531
532
533
534

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

535
[type="search"] {
Martijn Cuppens's avatar
Martijn Cuppens committed
536
537
  outline-offset: -2px; // 1
  -webkit-appearance: textfield; // 2
538
539
}

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

Martijn Cuppens's avatar
Martijn Cuppens committed
542
::-webkit-search-decoration {
543
544
545
  -webkit-appearance: none;
}

546
547
548
549
550
551
// Remove padding around color pickers in webkit browsers

::-webkit-color-swatch-wrapper {
  padding: 0;
}

Martijn Cuppens's avatar
Martijn Cuppens committed
552
553
// 1. Change font properties to `inherit` in Safari.
// 2. Correct the inability to style clickable types in iOS and Safari.
554
555

::-webkit-file-upload-button {
Martijn Cuppens's avatar
Martijn Cuppens committed
556
557
  font: inherit; // 1
  -webkit-appearance: button; // 2
558
559
560
561
}

// Correct element displays

562
output {
563
  display: inline-block;
564
565
}

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

568
summary {
Martijn Cuppens's avatar
Martijn Cuppens committed
569
  display: list-item; // 1
570
  cursor: pointer;
571
572
}

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

575
template {
Martijn Cuppens's avatar
Martijn Cuppens committed
576
  display: none;
577
}
578

Martijn Cuppens's avatar
Martijn Cuppens committed
579
580
581
582
583
584
main {
  display: block;
}

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

585
586
587
[hidden] {
  display: none !important;
}