|
| 1 | +@layer __reflex_base { |
| 2 | + /* |
| 3 | + 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) |
| 4 | + 2. Remove default margins and padding |
| 5 | + 3. Reset all borders. |
| 6 | + */ |
| 7 | + |
| 8 | + *, |
| 9 | + ::after, |
| 10 | + ::before, |
| 11 | + ::backdrop, |
| 12 | + ::file-selector-button { |
| 13 | + box-sizing: border-box; /* 1 */ |
| 14 | + margin: 0; /* 2 */ |
| 15 | + padding: 0; /* 2 */ |
| 16 | + border: 0 solid; /* 3 */ |
| 17 | + } |
| 18 | + |
| 19 | + /* |
| 20 | + 1. Use a consistent sensible line-height in all browsers. |
| 21 | + 2. Prevent adjustments of font size after orientation changes in iOS. |
| 22 | + 3. Use a more readable tab size. |
| 23 | + 4. Use the user's configured `sans` font-family by default. |
| 24 | + 5. Use the user's configured `sans` font-feature-settings by default. |
| 25 | + 6. Use the user's configured `sans` font-variation-settings by default. |
| 26 | + 7. Disable tap highlights on iOS. |
| 27 | + */ |
| 28 | + |
| 29 | + html, |
| 30 | + :host { |
| 31 | + line-height: 1.5; /* 1 */ |
| 32 | + -webkit-text-size-adjust: 100%; /* 2 */ |
| 33 | + tab-size: 4; /* 3 */ |
| 34 | + font-family: --theme( |
| 35 | + --default-font-family, |
| 36 | + ui-sans-serif, |
| 37 | + system-ui, |
| 38 | + sans-serif, |
| 39 | + "Apple Color Emoji", |
| 40 | + "Segoe UI Emoji", |
| 41 | + "Segoe UI Symbol", |
| 42 | + "Noto Color Emoji" |
| 43 | + ); /* 4 */ |
| 44 | + font-feature-settings: --theme( |
| 45 | + --default-font-feature-settings, |
| 46 | + normal |
| 47 | + ); /* 5 */ |
| 48 | + font-variation-settings: --theme( |
| 49 | + --default-font-variation-settings, |
| 50 | + normal |
| 51 | + ); /* 6 */ |
| 52 | + -webkit-tap-highlight-color: transparent; /* 7 */ |
| 53 | + } |
| 54 | + |
| 55 | + /* |
| 56 | + 1. Add the correct height in Firefox. |
| 57 | + 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) |
| 58 | + 3. Reset the default border style to a 1px solid border. |
| 59 | + */ |
| 60 | + |
| 61 | + hr { |
| 62 | + height: 0; /* 1 */ |
| 63 | + color: inherit; /* 2 */ |
| 64 | + border-top-width: 1px; /* 3 */ |
| 65 | + } |
| 66 | + |
| 67 | + /* |
| 68 | + Add the correct text decoration in Chrome, Edge, and Safari. |
| 69 | + */ |
| 70 | + |
| 71 | + abbr:where([title]) { |
| 72 | + -webkit-text-decoration: underline dotted; |
| 73 | + text-decoration: underline dotted; |
| 74 | + } |
| 75 | + |
| 76 | + /* |
| 77 | + Remove the default font size and weight for headings. |
| 78 | + */ |
| 79 | + |
| 80 | + h1, |
| 81 | + h2, |
| 82 | + h3, |
| 83 | + h4, |
| 84 | + h5, |
| 85 | + h6 { |
| 86 | + font-size: inherit; |
| 87 | + font-weight: inherit; |
| 88 | + } |
| 89 | + |
| 90 | + /* |
| 91 | + Reset links to optimize for opt-in styling instead of opt-out. |
| 92 | + */ |
| 93 | + |
| 94 | + a { |
| 95 | + color: inherit; |
| 96 | + -webkit-text-decoration: inherit; |
| 97 | + text-decoration: inherit; |
| 98 | + } |
| 99 | + |
| 100 | + /* |
| 101 | + Add the correct font weight in Edge and Safari. |
| 102 | + */ |
| 103 | + |
| 104 | + b, |
| 105 | + strong { |
| 106 | + font-weight: bolder; |
| 107 | + } |
| 108 | + |
| 109 | + /* |
| 110 | + 1. Use the user's configured `mono` font-family by default. |
| 111 | + 2. Use the user's configured `mono` font-feature-settings by default. |
| 112 | + 3. Use the user's configured `mono` font-variation-settings by default. |
| 113 | + 4. Correct the odd `em` font sizing in all browsers. |
| 114 | + */ |
| 115 | + |
| 116 | + code, |
| 117 | + kbd, |
| 118 | + samp, |
| 119 | + pre { |
| 120 | + font-family: --theme( |
| 121 | + --default-mono-font-family, |
| 122 | + ui-monospace, |
| 123 | + SFMono-Regular, |
| 124 | + Menlo, |
| 125 | + Monaco, |
| 126 | + Consolas, |
| 127 | + "Liberation Mono", |
| 128 | + "Courier New", |
| 129 | + monospace |
| 130 | + ); /* 1 */ |
| 131 | + font-feature-settings: --theme( |
| 132 | + --default-mono-font-feature-settings, |
| 133 | + normal |
| 134 | + ); /* 2 */ |
| 135 | + font-variation-settings: --theme( |
| 136 | + --default-mono-font-variation-settings, |
| 137 | + normal |
| 138 | + ); /* 3 */ |
| 139 | + font-size: 1em; /* 4 */ |
| 140 | + } |
| 141 | + |
| 142 | + /* |
| 143 | + Add the correct font size in all browsers. |
| 144 | + */ |
| 145 | + |
| 146 | + small { |
| 147 | + font-size: 80%; |
| 148 | + } |
| 149 | + |
| 150 | + /* |
| 151 | + Prevent `sub` and `sup` elements from affecting the line height in all browsers. |
| 152 | + */ |
| 153 | + |
| 154 | + sub, |
| 155 | + sup { |
| 156 | + font-size: 75%; |
| 157 | + line-height: 0; |
| 158 | + position: relative; |
| 159 | + vertical-align: baseline; |
| 160 | + } |
| 161 | + |
| 162 | + sub { |
| 163 | + bottom: -0.25em; |
| 164 | + } |
| 165 | + |
| 166 | + sup { |
| 167 | + top: -0.5em; |
| 168 | + } |
| 169 | + |
| 170 | + /* |
| 171 | + 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) |
| 172 | + 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) |
| 173 | + 3. Remove gaps between table borders by default. |
| 174 | + */ |
| 175 | + |
| 176 | + table { |
| 177 | + text-indent: 0; /* 1 */ |
| 178 | + border-color: inherit; /* 2 */ |
| 179 | + border-collapse: collapse; /* 3 */ |
| 180 | + } |
| 181 | + |
| 182 | + /* |
| 183 | + Use the modern Firefox focus style for all focusable elements. |
| 184 | + */ |
| 185 | + |
| 186 | + :-moz-focusring { |
| 187 | + outline: auto; |
| 188 | + } |
| 189 | + |
| 190 | + /* |
| 191 | + Add the correct vertical alignment in Chrome and Firefox. |
| 192 | + */ |
| 193 | + |
| 194 | + progress { |
| 195 | + vertical-align: baseline; |
| 196 | + } |
| 197 | + |
| 198 | + /* |
| 199 | + Add the correct display in Chrome and Safari. |
| 200 | + */ |
| 201 | + |
| 202 | + summary { |
| 203 | + display: list-item; |
| 204 | + } |
| 205 | + |
| 206 | + /* |
| 207 | + Make lists unstyled by default. |
| 208 | + */ |
| 209 | + |
| 210 | + ol, |
| 211 | + ul, |
| 212 | + menu { |
| 213 | + list-style: none; |
| 214 | + } |
| 215 | + |
| 216 | + /* |
| 217 | + 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) |
| 218 | + 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) |
| 219 | + This can trigger a poorly considered lint error in some tools but is included by design. |
| 220 | + */ |
| 221 | + |
| 222 | + img, |
| 223 | + svg, |
| 224 | + video, |
| 225 | + canvas, |
| 226 | + audio, |
| 227 | + iframe, |
| 228 | + embed, |
| 229 | + object { |
| 230 | + display: block; /* 1 */ |
| 231 | + vertical-align: middle; /* 2 */ |
| 232 | + } |
| 233 | + |
| 234 | + /* |
| 235 | + Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) |
| 236 | + */ |
| 237 | + |
| 238 | + img, |
| 239 | + video { |
| 240 | + max-width: 100%; |
| 241 | + height: auto; |
| 242 | + } |
| 243 | + |
| 244 | + /* |
| 245 | + 1. Inherit font styles in all browsers. |
| 246 | + 2. Remove border radius in all browsers. |
| 247 | + 3. Remove background color in all browsers. |
| 248 | + 4. Ensure consistent opacity for disabled states in all browsers. |
| 249 | + */ |
| 250 | + |
| 251 | + button, |
| 252 | + input, |
| 253 | + select, |
| 254 | + optgroup, |
| 255 | + textarea, |
| 256 | + ::file-selector-button { |
| 257 | + font: inherit; /* 1 */ |
| 258 | + font-feature-settings: inherit; /* 1 */ |
| 259 | + font-variation-settings: inherit; /* 1 */ |
| 260 | + letter-spacing: inherit; /* 1 */ |
| 261 | + color: inherit; /* 1 */ |
| 262 | + border-radius: 0; /* 2 */ |
| 263 | + background-color: transparent; /* 3 */ |
| 264 | + opacity: 1; /* 4 */ |
| 265 | + } |
| 266 | + |
| 267 | + /* |
| 268 | + Restore default font weight. |
| 269 | + */ |
| 270 | + |
| 271 | + :where(select:is([multiple], [size])) optgroup { |
| 272 | + font-weight: bolder; |
| 273 | + } |
| 274 | + |
| 275 | + /* |
| 276 | + Restore indentation. |
| 277 | + */ |
| 278 | + |
| 279 | + :where(select:is([multiple], [size])) optgroup option { |
| 280 | + padding-inline-start: 20px; |
| 281 | + } |
| 282 | + |
| 283 | + /* |
| 284 | + Restore space after button. |
| 285 | + */ |
| 286 | + |
| 287 | + ::file-selector-button { |
| 288 | + margin-inline-end: 4px; |
| 289 | + } |
| 290 | + |
| 291 | + /* |
| 292 | + Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) |
| 293 | + */ |
| 294 | + |
| 295 | + ::placeholder { |
| 296 | + opacity: 1; |
| 297 | + } |
| 298 | + |
| 299 | + /* |
| 300 | + Set the default placeholder color to a semi-transparent version of the current text color in browsers that do not |
| 301 | + crash when using `color-mix(…)` with `currentcolor`. (https://github.com/tailwindlabs/tailwindcss/issues/17194) |
| 302 | + */ |
| 303 | + |
| 304 | + @supports (not (-webkit-appearance: -apple-pay-button)) /* Not Safari */ or |
| 305 | + (contain-intrinsic-size: 1px) /* Safari 17+ */ { |
| 306 | + ::placeholder { |
| 307 | + color: color-mix(in oklab, currentcolor 50%, transparent); |
| 308 | + } |
| 309 | + } |
| 310 | + |
| 311 | + /* |
| 312 | + Prevent resizing textareas horizontally by default. |
| 313 | + */ |
| 314 | + |
| 315 | + textarea { |
| 316 | + resize: vertical; |
| 317 | + } |
| 318 | + |
| 319 | + /* |
| 320 | + Remove the inner padding in Chrome and Safari on macOS. |
| 321 | + */ |
| 322 | + |
| 323 | + ::-webkit-search-decoration { |
| 324 | + -webkit-appearance: none; |
| 325 | + } |
| 326 | + |
| 327 | + /* |
| 328 | + 1. Ensure date/time inputs have the same height when empty in iOS Safari. |
| 329 | + 2. Ensure text alignment can be changed on date/time inputs in iOS Safari. |
| 330 | + */ |
| 331 | + |
| 332 | + ::-webkit-date-and-time-value { |
| 333 | + min-height: 1lh; /* 1 */ |
| 334 | + text-align: inherit; /* 2 */ |
| 335 | + } |
| 336 | + |
| 337 | + /* |
| 338 | + Prevent height from changing on date/time inputs in macOS Safari when the input is set to `display: block`. |
| 339 | + */ |
| 340 | + |
| 341 | + ::-webkit-datetime-edit { |
| 342 | + display: inline-flex; |
| 343 | + } |
| 344 | + |
| 345 | + /* |
| 346 | + Remove excess padding from pseudo-elements in date/time inputs to ensure consistent height across browsers. |
| 347 | + */ |
| 348 | + |
| 349 | + ::-webkit-datetime-edit-fields-wrapper { |
| 350 | + padding: 0; |
| 351 | + } |
| 352 | + |
| 353 | + ::-webkit-datetime-edit, |
| 354 | + ::-webkit-datetime-edit-year-field, |
| 355 | + ::-webkit-datetime-edit-month-field, |
| 356 | + ::-webkit-datetime-edit-day-field, |
| 357 | + ::-webkit-datetime-edit-hour-field, |
| 358 | + ::-webkit-datetime-edit-minute-field, |
| 359 | + ::-webkit-datetime-edit-second-field, |
| 360 | + ::-webkit-datetime-edit-millisecond-field, |
| 361 | + ::-webkit-datetime-edit-meridiem-field { |
| 362 | + padding-block: 0; |
| 363 | + } |
| 364 | + |
| 365 | + /* |
| 366 | + Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) |
| 367 | + */ |
| 368 | + |
| 369 | + :-moz-ui-invalid { |
| 370 | + box-shadow: none; |
| 371 | + } |
| 372 | + |
| 373 | + /* |
| 374 | + Correct the inability to style the border radius in iOS Safari. |
| 375 | + */ |
| 376 | + |
| 377 | + button, |
| 378 | + input:where([type="button"], [type="reset"], [type="submit"]), |
| 379 | + ::file-selector-button { |
| 380 | + appearance: button; |
| 381 | + } |
| 382 | + |
| 383 | + /* |
| 384 | + Correct the cursor style of increment and decrement buttons in Safari. |
| 385 | + */ |
| 386 | + |
| 387 | + ::-webkit-inner-spin-button, |
| 388 | + ::-webkit-outer-spin-button { |
| 389 | + height: auto; |
| 390 | + } |
| 391 | + |
| 392 | + /* |
| 393 | + Make elements with the HTML hidden attribute stay hidden by default. |
| 394 | + */ |
| 395 | + |
| 396 | + [hidden]:where(:not([hidden="until-found"])) { |
| 397 | + display: none !important; |
| 398 | + } |
| 399 | +} |
0 commit comments