_reboot.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. // stylelint-disable declaration-no-important, selector-no-qualifying-type, property-no-vendor-prefix
  2. // Reboot
  3. //
  4. // Normalization of HTML elements, manually forked from Normalize.css to remove
  5. // styles targeting irrelevant browsers while applying new styles.
  6. //
  7. // Normalize is licensed MIT. https://github.com/necolas/normalize.css
  8. // Document
  9. //
  10. // Change from `box-sizing: content-box` so that `width` is not affected by `padding` or `border`.
  11. *,
  12. *::before,
  13. *::after {
  14. box-sizing: border-box;
  15. }
  16. // Root
  17. //
  18. // Ability to the value of the root font sizes, affecting the value of `rem`.
  19. // null by default, thus nothing is generated.
  20. :root {
  21. font-size: $font-size-root;
  22. @if $enable-smooth-scroll {
  23. @media (prefers-reduced-motion: no-preference) {
  24. scroll-behavior: smooth;
  25. }
  26. }
  27. }
  28. // Body
  29. //
  30. // 1. Remove the margin in all browsers.
  31. // 2. As a best practice, apply a default `background-color`.
  32. // 3. Prevent adjustments of font size after orientation changes in iOS.
  33. // 4. Change the default tap highlight to be completely transparent in iOS.
  34. body {
  35. margin: 0; // 1
  36. font-family: $font-family-base;
  37. @include font-size($font-size-base);
  38. font-weight: $font-weight-base;
  39. line-height: $line-height-base;
  40. color: $body-color;
  41. text-align: $body-text-align;
  42. background-color: $body-bg; // 2
  43. -webkit-text-size-adjust: 100%; // 3
  44. -webkit-tap-highlight-color: rgba($black, 0); // 4
  45. }
  46. // Content grouping
  47. //
  48. // 1. Reset Firefox's gray color
  49. // 2. Set correct height and prevent the `size` attribute to make the `hr` look like an input field
  50. hr {
  51. margin: $hr-margin-y 0;
  52. color: $hr-color; // 1
  53. background-color: currentColor;
  54. border: 0;
  55. opacity: $hr-opacity;
  56. }
  57. hr:not([size]) {
  58. height: $hr-height; // 2
  59. }
  60. // Typography
  61. //
  62. // 1. Remove top margins from headings
  63. // By default, `<h1>`-`<h6>` all receive top and bottom margins. We nuke the top
  64. // margin for easier control within type scales as it avoids margin collapsing.
  65. %heading {
  66. margin-top: 0; // 1
  67. margin-bottom: $headings-margin-bottom;
  68. font-family: $headings-font-family;
  69. font-style: $headings-font-style;
  70. font-weight: $headings-font-weight;
  71. line-height: $headings-line-height;
  72. color: $headings-color;
  73. }
  74. h1 {
  75. @extend %heading;
  76. @include font-size($h1-font-size);
  77. }
  78. h2 {
  79. @extend %heading;
  80. @include font-size($h2-font-size);
  81. }
  82. h3 {
  83. @extend %heading;
  84. @include font-size($h3-font-size);
  85. }
  86. h4 {
  87. @extend %heading;
  88. @include font-size($h4-font-size);
  89. }
  90. h5 {
  91. @extend %heading;
  92. @include font-size($h5-font-size);
  93. }
  94. h6 {
  95. @extend %heading;
  96. @include font-size($h6-font-size);
  97. }
  98. // Reset margins on paragraphs
  99. //
  100. // Similarly, the top margin on `<p>`s get reset. However, we also reset the
  101. // bottom margin to use `rem` units instead of `em`.
  102. p {
  103. margin-top: 0;
  104. margin-bottom: $paragraph-margin-bottom;
  105. }
  106. // Abbreviations
  107. //
  108. // 1. Duplicate behavior to the data-bs-* attribute for our tooltip plugin
  109. // 2. Add the correct text decoration in Chrome, Edge, Opera, and Safari.
  110. // 3. Add explicit cursor to indicate changed behavior.
  111. // 4. Prevent the text-decoration to be skipped.
  112. abbr[title],
  113. abbr[data-bs-original-title] { // 1
  114. text-decoration: underline dotted; // 2
  115. cursor: help; // 3
  116. text-decoration-skip-ink: none; // 4
  117. }
  118. // Address
  119. address {
  120. margin-bottom: 1rem;
  121. font-style: normal;
  122. line-height: inherit;
  123. }
  124. // Lists
  125. ol,
  126. ul {
  127. padding-left: 2rem;
  128. }
  129. ol,
  130. ul,
  131. dl {
  132. margin-top: 0;
  133. margin-bottom: 1rem;
  134. }
  135. ol ol,
  136. ul ul,
  137. ol ul,
  138. ul ol {
  139. margin-bottom: 0;
  140. }
  141. dt {
  142. font-weight: $dt-font-weight;
  143. }
  144. // 1. Undo browser default
  145. dd {
  146. margin-bottom: .5rem;
  147. margin-left: 0; // 1
  148. }
  149. // Blockquote
  150. blockquote {
  151. margin: 0 0 1rem;
  152. }
  153. // Strong
  154. //
  155. // Add the correct font weight in Chrome, Edge, and Safari
  156. b,
  157. strong {
  158. font-weight: $font-weight-bolder;
  159. }
  160. // Small
  161. //
  162. // Add the correct font size in all browsers
  163. small {
  164. @include font-size($small-font-size);
  165. }
  166. // Mark
  167. mark {
  168. padding: $mark-padding;
  169. background-color: $mark-bg;
  170. }
  171. // Sub and Sup
  172. //
  173. // Prevent `sub` and `sup` elements from affecting the line height in
  174. // all browsers.
  175. sub,
  176. sup {
  177. position: relative;
  178. @include font-size($sub-sup-font-size);
  179. line-height: 0;
  180. vertical-align: baseline;
  181. }
  182. sub { bottom: -.25em; }
  183. sup { top: -.5em; }
  184. // Links
  185. a {
  186. color: $link-color;
  187. text-decoration: $link-decoration;
  188. &:hover {
  189. color: $link-hover-color;
  190. text-decoration: $link-hover-decoration;
  191. }
  192. }
  193. // And undo these styles for placeholder links/named anchors (without href).
  194. // It would be more straightforward to just use a[href] in previous block, but that
  195. // causes specificity issues in many other styles that are too complex to fix.
  196. // See https://github.com/twbs/bootstrap/issues/19402
  197. a:not([href]):not([class]) {
  198. &,
  199. &:hover {
  200. color: inherit;
  201. text-decoration: none;
  202. }
  203. }
  204. // Code
  205. pre,
  206. code,
  207. kbd,
  208. samp {
  209. font-family: $font-family-code;
  210. @include font-size(1em); // Correct the odd `em` font sizing in all browsers.
  211. direction: ltr #{"/* rtl:ignore */"};
  212. unicode-bidi: bidi-override;
  213. }
  214. // 1. Remove browser default top margin
  215. // 2. Reset browser default of `1em` to use `rem`s
  216. // 3. Don't allow content to break outside
  217. pre {
  218. display: block;
  219. margin-top: 0; // 1
  220. margin-bottom: 1rem; // 2
  221. overflow: auto; // 3
  222. @include font-size($code-font-size);
  223. color: $pre-color;
  224. // Account for some code outputs that place code tags in pre tags
  225. code {
  226. @include font-size(inherit);
  227. color: inherit;
  228. word-break: normal;
  229. }
  230. }
  231. code {
  232. @include font-size($code-font-size);
  233. color: $code-color;
  234. word-wrap: break-word;
  235. // Streamline the style when inside anchors to avoid broken underline and more
  236. a > & {
  237. color: inherit;
  238. }
  239. }
  240. kbd {
  241. padding: $kbd-padding-y $kbd-padding-x;
  242. @include font-size($kbd-font-size);
  243. color: $kbd-color;
  244. background-color: $kbd-bg;
  245. @include border-radius($border-radius-sm);
  246. kbd {
  247. padding: 0;
  248. @include font-size(1em);
  249. font-weight: $nested-kbd-font-weight;
  250. }
  251. }
  252. // Figures
  253. //
  254. // Apply a consistent margin strategy (matches our type styles).
  255. figure {
  256. margin: 0 0 1rem;
  257. }
  258. // Images and content
  259. img,
  260. svg {
  261. vertical-align: middle;
  262. }
  263. // Tables
  264. //
  265. // Prevent double borders
  266. table {
  267. caption-side: bottom;
  268. border-collapse: collapse;
  269. }
  270. caption {
  271. padding-top: $table-cell-padding-y;
  272. padding-bottom: $table-cell-padding-y;
  273. color: $table-caption-color;
  274. text-align: left;
  275. }
  276. // 1. Removes font-weight bold by inheriting
  277. // 2. Matches default `<td>` alignment by inheriting `text-align`.
  278. // 3. Fix alignment for Safari
  279. th {
  280. font-weight: $table-th-font-weight; // 1
  281. text-align: inherit; // 2
  282. text-align: -webkit-match-parent; // 3
  283. }
  284. thead,
  285. tbody,
  286. tfoot,
  287. tr,
  288. td,
  289. th {
  290. border-color: inherit;
  291. border-style: solid;
  292. border-width: 0;
  293. }
  294. // Forms
  295. //
  296. // 1. Allow labels to use `margin` for spacing.
  297. label {
  298. display: inline-block; // 1
  299. }
  300. // Remove the default `border-radius` that macOS Chrome adds.
  301. // See https://github.com/twbs/bootstrap/issues/24093
  302. button {
  303. // stylelint-disable-next-line property-disallowed-list
  304. border-radius: 0;
  305. }
  306. // Explicitly remove focus outline in Chromium when it shouldn't be
  307. // visible (e.g. as result of mouse click or touch tap). It already
  308. // should be doing this automatically, but seems to currently be
  309. // confused and applies its very visible two-tone outline anyway.
  310. button:focus:not(:focus-visible) {
  311. outline: 0;
  312. }
  313. // 1. Remove the margin in Firefox and Safari
  314. input,
  315. button,
  316. select,
  317. optgroup,
  318. textarea {
  319. margin: 0; // 1
  320. font-family: inherit;
  321. @include font-size(inherit);
  322. line-height: inherit;
  323. }
  324. // Remove the inheritance of text transform in Firefox
  325. button,
  326. select {
  327. text-transform: none;
  328. }
  329. // Set the cursor for non-`<button>` buttons
  330. //
  331. // Details at https://github.com/twbs/bootstrap/pull/30562
  332. [role="button"] {
  333. cursor: pointer;
  334. }
  335. select {
  336. // Remove the inheritance of word-wrap in Safari.
  337. // See https://github.com/twbs/bootstrap/issues/24990
  338. word-wrap: normal;
  339. // Undo the opacity change from Chrome
  340. &:disabled {
  341. opacity: 1;
  342. }
  343. }
  344. // Remove the dropdown arrow in Chrome from inputs built with datalists.
  345. // See https://stackoverflow.com/a/54997118
  346. [list]::-webkit-calendar-picker-indicator {
  347. display: none;
  348. }
  349. // 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
  350. // controls in Android 4.
  351. // 2. Correct the inability to style clickable types in iOS and Safari.
  352. // 3. Opinionated: add "hand" cursor to non-disabled button elements.
  353. button,
  354. [type="button"], // 1
  355. [type="reset"],
  356. [type="submit"] {
  357. -webkit-appearance: button; // 2
  358. @if $enable-button-pointers {
  359. &:not(:disabled) {
  360. cursor: pointer; // 3
  361. }
  362. }
  363. }
  364. // Remove inner border and padding from Firefox, but don't restore the outline like Normalize.
  365. ::-moz-focus-inner {
  366. padding: 0;
  367. border-style: none;
  368. }
  369. // 1. Textareas should really only resize vertically so they don't break their (horizontal) containers.
  370. textarea {
  371. resize: vertical; // 1
  372. }
  373. // 1. Browsers set a default `min-width: min-content;` on fieldsets,
  374. // unlike e.g. `<div>`s, which have `min-width: 0;` by default.
  375. // So we reset that to ensure fieldsets behave more like a standard block element.
  376. // See https://github.com/twbs/bootstrap/issues/12359
  377. // and https://html.spec.whatwg.org/multipage/#the-fieldset-and-legend-elements
  378. // 2. Reset the default outline behavior of fieldsets so they don't affect page layout.
  379. fieldset {
  380. min-width: 0; // 1
  381. padding: 0; // 2
  382. margin: 0; // 2
  383. border: 0; // 2
  384. }
  385. // 1. By using `float: left`, the legend will behave like a block element.
  386. // This way the border of a fieldset wraps around the legend if present.
  387. // 2. Fix wrapping bug.
  388. // See https://github.com/twbs/bootstrap/issues/29712
  389. legend {
  390. float: left; // 1
  391. width: 100%;
  392. padding: 0;
  393. margin-bottom: $legend-margin-bottom;
  394. @include font-size($legend-font-size);
  395. font-weight: $legend-font-weight;
  396. line-height: inherit;
  397. + * {
  398. clear: left; // 2
  399. }
  400. }
  401. // Fix height of inputs with a type of datetime-local, date, month, week, or time
  402. // See https://github.com/twbs/bootstrap/issues/18842
  403. ::-webkit-datetime-edit-fields-wrapper,
  404. ::-webkit-datetime-edit-text,
  405. ::-webkit-datetime-edit-minute,
  406. ::-webkit-datetime-edit-hour-field,
  407. ::-webkit-datetime-edit-day-field,
  408. ::-webkit-datetime-edit-month-field,
  409. ::-webkit-datetime-edit-year-field {
  410. padding: 0;
  411. }
  412. ::-webkit-inner-spin-button {
  413. height: auto;
  414. }
  415. // 1. Correct the outline style in Safari.
  416. // 2. This overrides the extra rounded corners on search inputs in iOS so that our
  417. // `.form-control` class can properly style them. Note that this cannot simply
  418. // be added to `.form-control` as it's not specific enough. For details, see
  419. // https://github.com/twbs/bootstrap/issues/11586.
  420. [type="search"] {
  421. outline-offset: -2px; // 1
  422. -webkit-appearance: textfield; // 2
  423. }
  424. // 1. A few input types should stay LTR
  425. // See https://rtlstyling.com/posts/rtl-styling#form-inputs
  426. // 2. RTL only output
  427. // See https://rtlcss.com/learn/usage-guide/control-directives/#raw
  428. /* rtl:raw:
  429. [type="tel"],
  430. [type="url"],
  431. [type="email"],
  432. [type="number"] {
  433. direction: ltr;
  434. }
  435. */
  436. // Remove the inner padding in Chrome and Safari on macOS.
  437. ::-webkit-search-decoration {
  438. -webkit-appearance: none;
  439. }
  440. // Remove padding around color pickers in webkit browsers
  441. ::-webkit-color-swatch-wrapper {
  442. padding: 0;
  443. }
  444. // Inherit font family and line height for file input buttons
  445. ::file-selector-button {
  446. font: inherit;
  447. }
  448. // 1. Change font properties to `inherit`
  449. // 2. Correct the inability to style clickable types in iOS and Safari.
  450. ::-webkit-file-upload-button {
  451. font: inherit; // 1
  452. -webkit-appearance: button; // 2
  453. }
  454. // Correct element displays
  455. output {
  456. display: inline-block;
  457. }
  458. // Remove border from iframe
  459. iframe {
  460. border: 0;
  461. }
  462. // Summary
  463. //
  464. // 1. Add the correct display in all browsers
  465. summary {
  466. display: list-item; // 1
  467. cursor: pointer;
  468. }
  469. // Progress
  470. //
  471. // Add the correct vertical alignment in Chrome, Firefox, and Opera.
  472. progress {
  473. vertical-align: baseline;
  474. }
  475. // Hidden attribute
  476. //
  477. // Always hide an element with the `hidden` HTML attribute.
  478. [hidden] {
  479. display: none !important;
  480. }