preflight.css 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /*
  2. 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
  3. 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
  4. */
  5. *,
  6. ::before,
  7. ::after {
  8. box-sizing: border-box; /* 1 */
  9. border-width: 0; /* 2 */
  10. border-style: solid; /* 2 */
  11. border-color: theme('borderColor.DEFAULT', currentColor); /* 2 */
  12. }
  13. ::before,
  14. ::after {
  15. --tw-content: '';
  16. }
  17. /*
  18. 1. Use a consistent sensible line-height in all browsers.
  19. 2. Prevent adjustments of font size after orientation changes in iOS.
  20. 3. Use a more readable tab size.
  21. 4. Use the user's configured `sans` font-family by default.
  22. 5. Use the user's configured `sans` font-feature-settings by default.
  23. 6. Use the user's configured `sans` font-variation-settings by default.
  24. 7. Disable tap highlights on iOS
  25. */
  26. html,
  27. :host {
  28. line-height: 1.5; /* 1 */
  29. -webkit-text-size-adjust: 100%; /* 2 */
  30. -moz-tab-size: 4; /* 3 */
  31. tab-size: 4; /* 3 */
  32. font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
  33. font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
  34. font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
  35. -webkit-tap-highlight-color: transparent; /* 7 */
  36. }
  37. /*
  38. 1. Remove the margin in all browsers.
  39. 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
  40. */
  41. body {
  42. margin: 0; /* 1 */
  43. line-height: inherit; /* 2 */
  44. }
  45. /*
  46. 1. Add the correct height in Firefox.
  47. 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
  48. 3. Ensure horizontal rules are visible by default.
  49. */
  50. hr {
  51. height: 0; /* 1 */
  52. color: inherit; /* 2 */
  53. border-top-width: 1px; /* 3 */
  54. }
  55. /*
  56. Add the correct text decoration in Chrome, Edge, and Safari.
  57. */
  58. abbr:where([title]) {
  59. text-decoration: underline dotted;
  60. }
  61. /*
  62. Remove the default font size and weight for headings.
  63. */
  64. h1,
  65. h2,
  66. h3,
  67. h4,
  68. h5,
  69. h6 {
  70. font-size: inherit;
  71. font-weight: inherit;
  72. }
  73. /*
  74. Reset links to optimize for opt-in styling instead of opt-out.
  75. */
  76. a {
  77. color: inherit;
  78. text-decoration: inherit;
  79. }
  80. /*
  81. Add the correct font weight in Edge and Safari.
  82. */
  83. b,
  84. strong {
  85. font-weight: bolder;
  86. }
  87. /*
  88. 1. Use the user's configured `mono` font-family by default.
  89. 2. Use the user's configured `mono` font-feature-settings by default.
  90. 3. Use the user's configured `mono` font-variation-settings by default.
  91. 4. Correct the odd `em` font sizing in all browsers.
  92. */
  93. code,
  94. kbd,
  95. samp,
  96. pre {
  97. font-family: theme('fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); /* 1 */
  98. font-feature-settings: theme('fontFamily.mono[1].fontFeatureSettings', normal); /* 2 */
  99. font-variation-settings: theme('fontFamily.mono[1].fontVariationSettings', normal); /* 3 */
  100. font-size: 1em; /* 4 */
  101. }
  102. /*
  103. Add the correct font size in all browsers.
  104. */
  105. small {
  106. font-size: 80%;
  107. }
  108. /*
  109. Prevent `sub` and `sup` elements from affecting the line height in all browsers.
  110. */
  111. sub,
  112. sup {
  113. font-size: 75%;
  114. line-height: 0;
  115. position: relative;
  116. vertical-align: baseline;
  117. }
  118. sub {
  119. bottom: -0.25em;
  120. }
  121. sup {
  122. top: -0.5em;
  123. }
  124. /*
  125. 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
  126. 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
  127. 3. Remove gaps between table borders by default.
  128. */
  129. table {
  130. text-indent: 0; /* 1 */
  131. border-color: inherit; /* 2 */
  132. border-collapse: collapse; /* 3 */
  133. }
  134. /*
  135. 1. Change the font styles in all browsers.
  136. 2. Remove the margin in Firefox and Safari.
  137. 3. Remove default padding in all browsers.
  138. */
  139. button,
  140. input,
  141. optgroup,
  142. select,
  143. textarea {
  144. font-family: inherit; /* 1 */
  145. font-feature-settings: inherit; /* 1 */
  146. font-variation-settings: inherit; /* 1 */
  147. font-size: 100%; /* 1 */
  148. font-weight: inherit; /* 1 */
  149. line-height: inherit; /* 1 */
  150. letter-spacing: inherit; /* 1 */
  151. color: inherit; /* 1 */
  152. margin: 0; /* 2 */
  153. padding: 0; /* 3 */
  154. }
  155. /*
  156. Remove the inheritance of text transform in Edge and Firefox.
  157. */
  158. button,
  159. select {
  160. text-transform: none;
  161. }
  162. /*
  163. 1. Correct the inability to style clickable types in iOS and Safari.
  164. 2. Remove default button styles.
  165. */
  166. button,
  167. input:where([type='button']),
  168. input:where([type='reset']),
  169. input:where([type='submit']) {
  170. -webkit-appearance: button; /* 1 */
  171. background-color: transparent; /* 2 */
  172. background-image: none; /* 2 */
  173. }
  174. /*
  175. Use the modern Firefox focus style for all focusable elements.
  176. */
  177. :-moz-focusring {
  178. outline: auto;
  179. }
  180. /*
  181. Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
  182. */
  183. :-moz-ui-invalid {
  184. box-shadow: none;
  185. }
  186. /*
  187. Add the correct vertical alignment in Chrome and Firefox.
  188. */
  189. progress {
  190. vertical-align: baseline;
  191. }
  192. /*
  193. Correct the cursor style of increment and decrement buttons in Safari.
  194. */
  195. ::-webkit-inner-spin-button,
  196. ::-webkit-outer-spin-button {
  197. height: auto;
  198. }
  199. /*
  200. 1. Correct the odd appearance in Chrome and Safari.
  201. 2. Correct the outline style in Safari.
  202. */
  203. [type='search'] {
  204. -webkit-appearance: textfield; /* 1 */
  205. outline-offset: -2px; /* 2 */
  206. }
  207. /*
  208. Remove the inner padding in Chrome and Safari on macOS.
  209. */
  210. ::-webkit-search-decoration {
  211. -webkit-appearance: none;
  212. }
  213. /*
  214. 1. Correct the inability to style clickable types in iOS and Safari.
  215. 2. Change font properties to `inherit` in Safari.
  216. */
  217. ::-webkit-file-upload-button {
  218. -webkit-appearance: button; /* 1 */
  219. font: inherit; /* 2 */
  220. }
  221. /*
  222. Add the correct display in Chrome and Safari.
  223. */
  224. summary {
  225. display: list-item;
  226. }
  227. /*
  228. Removes the default spacing and border for appropriate elements.
  229. */
  230. blockquote,
  231. dl,
  232. dd,
  233. h1,
  234. h2,
  235. h3,
  236. h4,
  237. h5,
  238. h6,
  239. hr,
  240. figure,
  241. p,
  242. pre {
  243. margin: 0;
  244. }
  245. fieldset {
  246. margin: 0;
  247. padding: 0;
  248. }
  249. legend {
  250. padding: 0;
  251. }
  252. ol,
  253. ul,
  254. menu {
  255. list-style: none;
  256. margin: 0;
  257. padding: 0;
  258. }
  259. /*
  260. Reset default styling for dialogs.
  261. */
  262. dialog {
  263. padding: 0;
  264. }
  265. /*
  266. Prevent resizing textareas horizontally by default.
  267. */
  268. textarea {
  269. resize: vertical;
  270. }
  271. /*
  272. 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
  273. 2. Set the default placeholder color to the user's configured gray 400 color.
  274. */
  275. input::placeholder,
  276. textarea::placeholder {
  277. opacity: 1; /* 1 */
  278. color: theme('colors.gray.400', #9ca3af); /* 2 */
  279. }
  280. /*
  281. Set the default cursor for buttons.
  282. */
  283. button,
  284. [role="button"] {
  285. cursor: pointer;
  286. }
  287. /*
  288. Make sure disabled buttons don't get the pointer cursor.
  289. */
  290. :disabled {
  291. cursor: default;
  292. }
  293. /*
  294. 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
  295. 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
  296. This can trigger a poorly considered lint error in some tools but is included by design.
  297. */
  298. img,
  299. svg,
  300. video,
  301. canvas,
  302. audio,
  303. iframe,
  304. embed,
  305. object {
  306. display: block; /* 1 */
  307. vertical-align: middle; /* 2 */
  308. }
  309. /*
  310. Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
  311. */
  312. img,
  313. video {
  314. max-width: 100%;
  315. height: auto;
  316. }
  317. /* Make elements with the HTML hidden attribute stay hidden by default */
  318. [hidden]:where(:not([hidden="until-found"])) {
  319. display: none;
  320. }