_reboot.scss 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. // scss-lint:disable QualifyingElement, DuplicateProperty
  2. // Reboot
  3. //
  4. // Global resets to common HTML elements and more for easier usage by Bootstrap.
  5. // Adds additional rules on top of Normalize.css, including several overrides.
  6. // Reset the box-sizing
  7. //
  8. // Change from `box-sizing: content-box` to `border-box` so that when you add
  9. // `padding` or `border`s to an element, the overall declared `width` does not
  10. // change. For example, `width: 100px;` will always be `100px` despite the
  11. // `border: 10px solid red;` and `padding: 20px;`.
  12. //
  13. // Heads up! This reset may cause conflicts with some third-party widgets. For
  14. // recommendations on resolving such conflicts, see
  15. // https://getbootstrap.com/getting-started/#third-box-sizing.
  16. //
  17. // Credit: https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/
  18. html {
  19. box-sizing: border-box;
  20. }
  21. *,
  22. *::before,
  23. *::after {
  24. box-sizing: inherit;
  25. }
  26. // Make viewport responsive
  27. //
  28. // @viewport is needed because IE 10+ doesn't honor <meta name="viewport"> in
  29. // some cases. See https://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/.
  30. // Eventually @viewport will replace <meta name="viewport">.
  31. //
  32. // However, `device-width` is broken on IE 10 on Windows (Phone) 8,
  33. // (see https://timkadlec.com/2013/01/windows-phone-8-and-device-width/ and https://github.com/twbs/bootstrap/issues/10497)
  34. // and the fix for that involves a snippet of JavaScript to sniff the user agent
  35. // and apply some conditional CSS.
  36. //
  37. // See https://getbootstrap.com/getting-started/#support-ie10-width for the relevant hack.
  38. //
  39. // Wrap `@viewport` with `@at-root` for when folks do a nested import (e.g.,
  40. // `.class-name { @import "bootstrap"; }`).
  41. @at-root {
  42. @-ms-viewport { width: device-width; }
  43. }
  44. //
  45. // Reset HTML, body, and more
  46. //
  47. html {
  48. // Sets a specific default `font-size` for user with `rem` type scales.
  49. font-size: $font-size-root;
  50. // As a side-effect of setting the @viewport above,
  51. // IE11 & Edge make the scrollbar overlap the content and automatically hide itself when not in use.
  52. // Unfortunately, the auto-showing of the scrollbar is sometimes too sensitive,
  53. // thus making it hard to click on stuff near the right edge of the page.
  54. // So we add this style to force IE11 & Edge to use a "normal", non-overlapping, non-auto-hiding scrollbar.
  55. // See https://github.com/twbs/bootstrap/issues/18543
  56. -ms-overflow-style: scrollbar;
  57. // Changes the default tap highlight to be completely transparent in iOS.
  58. -webkit-tap-highlight-color: rgba(0,0,0,0);
  59. }
  60. body {
  61. // Make the `body` use the `font-size-root`
  62. font-family: $font-family-base;
  63. font-size: $font-size-base;
  64. line-height: $line-height-base;
  65. // Go easy on the eyes and use something other than `#000` for text
  66. color: $body-color;
  67. // By default, `<body>` has no `background-color` so we set one as a best practice.
  68. background-color: $body-bg;
  69. }
  70. // Suppress the focus outline on elements that cannot be accessed via keyboard.
  71. // This prevents an unwanted focus outline from appearing around elements that
  72. // might still respond to pointer events.
  73. //
  74. // Credit: https://github.com/suitcss/base
  75. [tabindex="-1"]:focus {
  76. outline: none !important;
  77. }
  78. //
  79. // Typography
  80. //
  81. // Remove top margins from headings
  82. //
  83. // By default, `<h1>`-`<h6>` all receive top and bottom margins. We nuke the top
  84. // margin for easier control within type scales as it avoids margin collapsing.
  85. h1, h2, h3, h4, h5, h6 {
  86. margin-top: 0;
  87. margin-bottom: .5rem;
  88. }
  89. // Reset margins on paragraphs
  90. //
  91. // Similarly, the top margin on `<p>`s get reset. However, we also reset the
  92. // bottom margin to use `rem` units instead of `em`.
  93. p {
  94. margin-top: 0;
  95. margin-bottom: 1rem;
  96. }
  97. // Abbreviations and acronyms
  98. abbr[title],
  99. // Add data-* attribute to help out our tooltip plugin, per https://github.com/twbs/bootstrap/issues/5257
  100. abbr[data-original-title] {
  101. cursor: help;
  102. border-bottom: 1px dotted $abbr-border-color;
  103. }
  104. address {
  105. margin-bottom: 1rem;
  106. font-style: normal;
  107. line-height: inherit;
  108. }
  109. ol,
  110. ul,
  111. dl {
  112. margin-top: 0;
  113. margin-bottom: 1rem;
  114. }
  115. ol ol,
  116. ul ul,
  117. ol ul,
  118. ul ol {
  119. margin-bottom: 0;
  120. }
  121. dt {
  122. font-weight: $dt-font-weight;
  123. }
  124. dd {
  125. margin-bottom: .5rem;
  126. margin-left: 0; // Undo browser default
  127. }
  128. blockquote {
  129. margin: 0 0 1rem;
  130. }
  131. //
  132. // Links
  133. //
  134. a {
  135. color: $link-color;
  136. text-decoration: $link-decoration;
  137. @include hover-focus {
  138. color: $link-hover-color;
  139. text-decoration: $link-hover-decoration;
  140. }
  141. &:focus {
  142. @include tab-focus();
  143. }
  144. }
  145. // And undo these styles for placeholder links/named anchors (without href)
  146. // which have not been made explicitly keyboard-focusable (without tabindex).
  147. // It would be more straightforward to just use a[href] in previous block, but that
  148. // causes specificity issues in many other styles that are too complex to fix.
  149. // See https://github.com/twbs/bootstrap/issues/19402
  150. a:not([href]):not([tabindex]) {
  151. color: inherit;
  152. text-decoration: none;
  153. @include hover-focus {
  154. color: inherit;
  155. text-decoration: none;
  156. }
  157. &:focus {
  158. outline: none;
  159. }
  160. }
  161. //
  162. // Code
  163. //
  164. pre {
  165. // Remove browser default top margin
  166. margin-top: 0;
  167. // Reset browser default of `1em` to use `rem`s
  168. margin-bottom: 1rem;
  169. // Normalize v4 removed this property, causing `<pre>` content to break out of wrapping code snippets
  170. overflow: auto;
  171. }
  172. //
  173. // Figures
  174. //
  175. figure {
  176. // Normalize adds `margin` to `figure`s as browsers apply it inconsistently.
  177. // We reset that to create a better flow in-page.
  178. margin: 0 0 1rem;
  179. }
  180. //
  181. // Images
  182. //
  183. img {
  184. // By default, `<img>`s are `inline-block`. This assumes that, and vertically
  185. // centers them. This won't apply should you reset them to `block` level.
  186. vertical-align: middle;
  187. // Note: `<img>`s are deliberately not made responsive by default.
  188. // For the rationale behind this, see the comments on the `.img-fluid` class.
  189. }
  190. // iOS "clickable elements" fix for role="button"
  191. //
  192. // Fixes "clickability" issue (and more generally, the firing of events such as focus as well)
  193. // for traditionally non-focusable elements with role="button"
  194. // see https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile
  195. [role="button"] {
  196. cursor: pointer;
  197. }
  198. // Avoid 300ms click delay on touch devices that support the `touch-action` CSS property.
  199. //
  200. // In particular, unlike most other browsers, IE11+Edge on Windows 10 on touch devices and IE Mobile 10-11
  201. // DON'T remove the click delay when `<meta name="viewport" content="width=device-width">` is present.
  202. // However, they DO support removing the click delay via `touch-action: manipulation`.
  203. // See:
  204. // * https://v4-alpha.getbootstrap.com/content/reboot/#click-delay-optimization-for-touch
  205. // * http://caniuse.com/#feat=css-touch-action
  206. // * https://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay
  207. a,
  208. area,
  209. button,
  210. [role="button"],
  211. input,
  212. label,
  213. select,
  214. summary,
  215. textarea {
  216. touch-action: manipulation;
  217. }
  218. //
  219. // Tables
  220. //
  221. table {
  222. // No longer part of Normalize since v4
  223. border-collapse: collapse;
  224. // Reset for nesting within parents with `background-color`.
  225. background-color: $table-bg;
  226. }
  227. caption {
  228. padding-top: $table-cell-padding;
  229. padding-bottom: $table-cell-padding;
  230. color: $text-muted;
  231. text-align: left;
  232. caption-side: bottom;
  233. }
  234. th {
  235. // Centered by default, but left-align-ed to match the `td`s below.
  236. text-align: left;
  237. }
  238. //
  239. // Forms
  240. //
  241. label {
  242. // Allow labels to use `margin` for spacing.
  243. display: inline-block;
  244. margin-bottom: .5rem;
  245. }
  246. // Work around a Firefox/IE bug where the transparent `button` background
  247. // results in a loss of the default `button` focus styles.
  248. //
  249. // Credit: https://github.com/suitcss/base/
  250. button:focus {
  251. outline: 1px dotted;
  252. outline: 5px auto -webkit-focus-ring-color;
  253. }
  254. input,
  255. button,
  256. select,
  257. textarea {
  258. // Normalize includes `font: inherit;`, so `font-family`. `font-size`, etc are
  259. // properly inherited. However, `line-height` isn't inherited there.
  260. line-height: inherit;
  261. }
  262. input[type="radio"],
  263. input[type="checkbox"] {
  264. // Apply a disabled cursor for radios and checkboxes.
  265. //
  266. // Note: Neither radios nor checkboxes can be readonly.
  267. &:disabled {
  268. cursor: $cursor-disabled;
  269. }
  270. }
  271. input[type="date"],
  272. input[type="time"],
  273. input[type="datetime-local"],
  274. input[type="month"] {
  275. // Remove the default appearance of temporal inputs to avoid a Mobile Safari
  276. // bug where setting a custom line-height prevents text from being vertically
  277. // centered within the input.
  278. //
  279. // Bug report: https://github.com/twbs/bootstrap/issues/11266
  280. -webkit-appearance: listbox;
  281. }
  282. textarea {
  283. // Textareas should really only resize vertically so they don't break their (horizontal) containers.
  284. resize: vertical;
  285. }
  286. fieldset {
  287. // Chrome and Firefox set a `min-width: min-content;` on fieldsets,
  288. // so we reset that to ensure it behaves more like a standard block element.
  289. // See https://github.com/twbs/bootstrap/issues/12359.
  290. min-width: 0;
  291. // Reset the default outline behavior of fieldsets so they don't affect page layout.
  292. padding: 0;
  293. margin: 0;
  294. border: 0;
  295. }
  296. legend {
  297. // Reset the entire legend element to match the `fieldset`
  298. display: block;
  299. width: 100%;
  300. padding: 0;
  301. margin-bottom: .5rem;
  302. font-size: 1.5rem;
  303. line-height: inherit;
  304. }
  305. input[type="search"] {
  306. // This overrides the extra rounded corners on search inputs in iOS so that our
  307. // `.form-control` class can properly style them. Note that this cannot simply
  308. // be added to `.form-control` as it's not specific enough. For details, see
  309. // https://github.com/twbs/bootstrap/issues/11586.
  310. -webkit-appearance: none;
  311. }
  312. // todo: needed?
  313. output {
  314. display: inline-block;
  315. // font-size: $font-size-base;
  316. // line-height: $line-height;
  317. // color: $input-color;
  318. }
  319. // Always hide an element with the `hidden` HTML attribute (from PureCSS).
  320. [hidden] {
  321. display: none !important;
  322. }