css-preflight 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Brett Wood
3
+ Copyright (c) 2023-2025 Brett Wood
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,28 +1,31 @@
1
1
  # CSS Preflight
2
2
 
3
- [![npm](https://img.shields.io/npm/v/css-preflight?color=red)](https://www.npmjs.com/package/css-preflight)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/woodbrettm/css-preflight/blob/main/LICENSE.md)
3
+ This is a CSS browser reset based on Tailwind's preflight, optimized for
4
+ non-Tailwind projects. Optional enhancements like smooth scrolling and
5
+ other utilities are also provided.
5
6
 
6
- This is a CSS browser reset based on Tailwind's preflight, optimized for non-Tailwind projects. **Optional** enhancements like smooth scrolling and other utilities are also provided (see usage).
7
+ ## Differences to Tailwind's Preflight
7
8
 
8
- ## Preflight
9
+ The following adjustments have been made to to the preflight:
9
10
 
10
- The following adjustments have been made to Tailwind's preflight, located in `styles/preflight.css`:
11
+ 1. Tailwind-specific CSS variables and styling removed.
12
+ 2. Two Tailwind `font-family` defaults have been removed from the
13
+ preflight in favor of optional imports. One was setting the
14
+ default font stack for the overall html document, and the other
15
+ was setting monospace fonts for html elements like `code`.
11
16
 
12
- 1. Tailwind-specific CSS variables removed.
13
- 2. Tailwind postcss functions like `theme()` removed.
14
- 3. Vendor prefixes (e.g. `-webkit-`, `-moz-`) from css properties have been removed, to avoid duplication
15
- from autoprefixer when used. Inline comments in the `preflight.css` source code indicate which of
16
- these have been adjusted and note the original existing prefix.
17
- 4. system-ui fonts have been removed completely from `font-family` properties in exchange for
18
- either websafe fonts (e.g. Courier New for monospace elements), or removed completely (in the case
19
- of the original preflight's font-family on `:root`).
17
+ #### Why Font Family Defaults Removed
20
18
 
21
- #### Removing System UI Fonts
19
+ Font stacks are a rapidly evolving space at the moment, and the use of
20
+ system fonts is becoming more common, such as in Tailwind's
21
+ preflight. However, the use of `system-ui` and similar values for the `font-family`
22
+ property can be problematic. They not only depend on the OS version,
23
+ but on the language settings of the OS as well, which can be unpredictable,
24
+ according to the following article: https://infinnie.github.io/blog/2017/systemui.html.
22
25
 
23
- system-ui fonts can be problematic as they not only depend on the OS version, but on the language
24
- settings of the OS as well. These have been removed as it's felt they're too unpredictable to be
25
- left in as a preflight, and better left for a dev to intentionally specify them.
26
+ Granted, this is an older article, but as a precaution, `font-family` defaults
27
+ have been moved to optional imports with possible system fonts being manually
28
+ specified over the usage of `system-ui`, `monospace-ui`, etc.
26
29
 
27
30
  ## Installation
28
31
 
@@ -34,56 +37,137 @@ pnpm add css-preflight
34
37
  npm install css-preflight
35
38
  ```
36
39
 
37
- ## Usage
40
+ ## Typical Usage
38
41
 
39
- The exports are broken down into 4 main CSS files. Completely
40
- unprocessed so it's up to the dev to pass them through optimizations like
41
- Autoprefixer and minification.
42
+ Note this setup doesn't contain any defaults for the main font. Those are
43
+ available as optional imports.
42
44
 
43
- Simply import these into the root layout file (like `Layout.astro` for example).
44
- They should be imported first before any other CSS imports.
45
+ ```javascript
46
+ // main preflight
47
+ // import "css-preflight" does the same.
48
+ import "css-preflight/preflight.css";
49
+
50
+ // Sets default fonts for html elements that use monospace fonts
51
+ // Unnecessary to use this if wanting to set your own monospace fonts
52
+ import "css-preflight/mono-elements.css";
53
+ ```
54
+
55
+ For fastest performance, it's recommended to have the css directly
56
+ injected into the html as a `<style>` tag, along with any other critical
57
+ css applying to above-the-fold content. Avoid putting the `<style>` tag
58
+ inside `<head>` as invalid css can break processing of other elements
59
+ inside `<head>`.
60
+
61
+ ```html
62
+ <head></head>
63
+ <body>
64
+ <style>
65
+ <!-- Inject here -->
66
+ </style>
67
+ <!-- rest of html -->
68
+ </body>
69
+ ```
70
+
71
+ Reminder to set emoji font fallbacks when defining your own
72
+ font stacks:
73
+
74
+ ```css
75
+ :root,
76
+ :host {
77
+ font-family:
78
+ /* Your fonts here */
79
+ /* then do: */
80
+ sans-serif,
81
+ /* or serif, or monospace, etc. */ "Apple Color Emoji",
82
+ "Segoe UI Emoji",
83
+ "Segoe UI Symbol",
84
+ "Noto Color Emoji";
85
+ }
86
+ ```
87
+
88
+ ## Package Exports
89
+
90
+ ### Main Preflight
91
+
92
+ The main Tailwind-derived CSS reset.
45
93
 
46
- #### Possible Imports
94
+ #### Bare Import
47
95
 
48
96
  ```javascript
49
- import 'css-preflight'; // styles/preflight.css
50
- import 'css-preflight/preflight'; // ALIAS: styles/preflight.css
97
+ import "css-preflight"; // styles/preflight.css
98
+ ```
99
+
100
+ #### Named Import
51
101
 
52
- import 'css-preflight/enhancements'; // styles/enhancements.css
53
- import 'css-preflight/smooth-scroll'; // styles/smooth-scroll.css
54
- import 'css-preflight/rem-same-px'; // styles/rem-same-px.css
102
+ ```javascript
103
+ import "css-preflight/preflight.css"; // styles/preflight.css
55
104
  ```
56
105
 
57
- #### Typical Setup
106
+ ### Default Main Fonts
107
+
108
+ Sets a default main font for the document (body text, headings, etc.) Only applies these
109
+ to `:root` and `:host`, to be inherited by other elements. Useful in development when
110
+ no main font has been chosen for the design yet, or for simple testing purposes.
111
+
112
+ #### Mono
58
113
 
59
114
  ```javascript
60
- import 'css-preflight';
61
- import 'css-preflight/enhancements';
115
+ import "css-preflight/font-mono.css";
62
116
  ```
63
117
 
64
- ### Preflight
118
+ #### Sans Serif
65
119
 
66
- Tailwind preflight (with adjustments mentioned previously). Can either do a bare
67
- `css-preflight` import, or use the more verbose option of `css-preflight/preflight`.
68
- Both are exactly the same.
120
+ ```javascript
121
+ import "css-preflight/font-sans-serif.css";
122
+ ```
69
123
 
70
- ### Enhancements
124
+ #### Serif
71
125
 
72
- These are small enhancements added to the main preflight:
126
+ ```javascript
127
+ import "css-preflight/font-serif.css";
128
+ ```
73
129
 
74
- - Adds `text-wrap: balance` on h1-h6 and blockquote. Helps prevent hanging words on newlines.
130
+ ### Mono Elements
131
+
132
+ Sets a default mono font stack for the `code`, `kbd`, `samp`, and `pre`
133
+ html elements. Many design and branding systems don't include
134
+ mono font guidelines so this option can be useful for those cases.
135
+
136
+ ```javascript
137
+ import "css-preflight/mono-elements.css";
138
+ ```
139
+
140
+ ### Rem Same Px
141
+
142
+ Sets `1 rem = 1px` at the root for easier design-dev handoff. This calculation is done
143
+ using `%`, so if the user adjusts the browser font sizes, those will still affect the page
144
+ for accessibility purposes.
145
+
146
+ Can sometimes mess up dev environment error messages though (the error UI becomes very,
147
+ very small). That can be fixed of course, but just an FYI.
148
+
149
+ ```javascript
150
+ import "css-preflight/rem-same-px.css"; // styles/rem-same-px.css
151
+ ```
75
152
 
76
153
  ### Smooth Scroll
77
154
 
78
155
  Enables smooth scrolling to anchor points (e.g. #about). Disabled for `prefers-reduced-motion`.
79
156
 
80
- ### Rem Same Px
157
+ ```javascript
158
+ import "css-preflight/smooth-scroll.css"; // styles/smooth-scroll.css
159
+ ```
81
160
 
82
- Sets rem equal to 1px at the root for easier design-dev handoff. This calculation is done
83
- using `%`, so the browser root font size will still affect fonts using `rem` for
84
- accessibility purposes.
161
+ ### Text Wrap Balance
162
+
163
+ Adds `text-wrap: balance` on h1-h6 and blockquote. Helps prevent single hanging words on
164
+ heading newlines.
165
+
166
+ ```javascript
167
+ import "css-preflight/text-wrap-balance.css"; // styles/text-wrap-balance.css
168
+ ```
85
169
 
86
- ### License
170
+ ## License
87
171
 
88
172
  The repo falls under MIT licensing, contained in the LICENSE.md file.
89
173
  Usage of the `preflight.css` file is also subject to Tailwind's licensing (MIT), which is included
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "css-preflight",
4
- "version": "1.1.1",
4
+ "version": "2.0.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "CSS browser reset based on Tailwind's preflight, with optional enhancements.",
@@ -27,10 +27,14 @@
27
27
  "style": "./styles/preflight.css",
28
28
  "exports": {
29
29
  ".": "./styles/preflight.css",
30
- "./preflight": "./styles/preflight.css",
31
- "./enhancements": "./styles/enhancements.css",
32
- "./smooth-scroll": "./styles/smooth-scroll.css",
33
- "./rem-same-px": "./styles/rem-same-px.css"
30
+ "./preflight.css": "./styles/preflight.css",
31
+ "./font-mono.css": "./styles/font-mono.css",
32
+ "./font-sans-serif.css": "./styles/font-sans-serif.css",
33
+ "./font-serif.css": "./styles/font-serif.css",
34
+ "./mono-elements.css": "./styles/mono-elements.css",
35
+ "./rem-same-px.css": "./styles/rem-same-px.css",
36
+ "./smooth-scroll.css": "./styles/smooth-scroll.css",
37
+ "./text-wrap-balance.css": "./styles/text-wrap-balance.css"
34
38
  },
35
39
  "files": [
36
40
  "LICENSE.md",
@@ -40,15 +44,17 @@
40
44
  "README.md"
41
45
  ],
42
46
  "devDependencies": {
43
- "@changesets/cli": "2.27.1",
44
- "stylelint": "15.11.0",
45
- "stylelint-config-standard": "34.0.0",
46
- "prettier": "3.1.0"
47
+ "@changesets/cli": "2.29.5",
48
+ "prettier": "3.6.2",
49
+ "vite": "7.0.4",
50
+ "eslint": "9.31.0",
51
+ "@eslint/css": "0.10.0"
47
52
  },
48
53
  "scripts": {
49
- "stylelint": "stylelint \"./styles/*.css\"",
50
- "prettier-check": "prettier --check ./styles/*.css",
54
+ "changeset:version": "changeset version",
55
+ "changeset:add": "changeset",
51
56
  "changeset:release": "changeset publish",
52
- "changeset:add": "changeset"
57
+ "dev": "vite dev --config \"./playground/vite.config.js\"",
58
+ "lint:css": "eslint \"./styles/**\""
53
59
  }
54
60
  }
@@ -0,0 +1,34 @@
1
+ /*
2
+ Font list is built using a combination of Tailwind's mono settings and:
3
+ https://qwtel.com/posts/software/the-monospaced-system-ui-css-font-stack/
4
+
5
+ Use of system-ui has been removed.
6
+ https://infinnie.github.io/blog/2017/systemui.html
7
+ */
8
+
9
+ :root,
10
+ :host {
11
+ font-family:
12
+ "SFMono-Regular",
13
+ "Menlo",
14
+ "Monaco",
15
+ "Cascadia Mono",
16
+ "Segoe UI Mono",
17
+ "Roboto Mono",
18
+ "Oxygen Mono",
19
+ "Ubuntu Mono",
20
+ "DejaVu Sans Mono",
21
+ "Source Code Pro",
22
+ "Fira Mono",
23
+ "Droid Sans Mono",
24
+ "Consolas",
25
+ "Liberation Mono",
26
+ "Courier New",
27
+ monospace,
28
+ 'Apple Color Emoji',
29
+ 'Segoe UI Emoji',
30
+ 'Segoe UI Symbol',
31
+ 'Noto Color Emoji';
32
+ font-feature-settings: normal;
33
+ font-variation-settings: normal;
34
+ }
@@ -0,0 +1,21 @@
1
+ :root,
2
+ :host {
3
+ font-family:
4
+ "Inter",
5
+ "SF Pro",
6
+ "San Francisco",
7
+ "Segoe UI",
8
+ "Roboto",
9
+ "Liberation Sans",
10
+ "Helvetica Neue",
11
+ "Arial Nova",
12
+ "Helvetica",
13
+ "Arial",
14
+ sans-serif,
15
+ "Apple Color Emoji",
16
+ "Segoe UI Emoji",
17
+ "Segoe UI Symbol",
18
+ "Noto Color Emoji";
19
+ font-feature-settings: normal;
20
+ font-variation-settings: normal;
21
+ }
@@ -0,0 +1,21 @@
1
+ :root,
2
+ :host {
3
+ font-family:
4
+ "Roboto Serif",
5
+ "Droid Serif",
6
+ "Baskerville",
7
+ "New York",
8
+ "Liberation Serif",
9
+ "Cantarell",
10
+ "Palatino",
11
+ "Georgia",
12
+ "Garamond",
13
+ "Times New Roman",
14
+ serif,
15
+ "Apple Color Emoji",
16
+ "Segoe UI Emoji",
17
+ "Segoe UI Symbol",
18
+ "Noto Color Emoji";
19
+ font-feature-settings: normal;
20
+ font-variation-settings: normal;
21
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ Font list is built using a combination of Tailwind's mono settings and:
3
+ https://qwtel.com/posts/software/the-monospaced-system-ui-css-font-stack/
4
+
5
+ Use of system-ui has been removed.
6
+ https://infinnie.github.io/blog/2017/systemui.html
7
+ */
8
+
9
+ code,
10
+ kbd,
11
+ samp,
12
+ pre {
13
+ font-family:
14
+ SFMono-Regular,
15
+ Menlo,
16
+ Monaco,
17
+ "Cascadia Mono",
18
+ "Segoe UI Mono",
19
+ "Roboto Mono",
20
+ "Oxygen Mono",
21
+ "Ubuntu Mono",
22
+ "SF Mono",
23
+ "Source Code Pro",
24
+ "Fira Mono",
25
+ "Droid Sans Mono",
26
+ "Consolas",
27
+ "Liberation Mono",
28
+ "Courier New",
29
+ monospace;
30
+ font-feature-settings: normal;
31
+ font-variation-settings: normal;
32
+ }
@@ -1,38 +1,52 @@
1
- *,
2
- ::before,
3
- ::after {
4
- box-sizing: border-box;
5
- }
1
+ /*
2
+ https://github.com/tailwindlabs/tailwindcss/blob/88b9f15b65588a87c5b6b13316530b4aecbc1b0b/packages/tailwindcss/preflight.css
3
+ Up to Commit 88b9f15, Jul 15, 2025
4
+
5
+ Comments with the keyword: "REMOVED" indicate styles existing in Tailwind's preflight that have been removed here.
6
+ */
6
7
 
7
8
  /*
8
- 1. Use a consistent sensible line-height in all browsers.
9
- 2. Prevent adjustments of font size after orientation changes in iOS.
10
- 3. Use a more readable tab size.
11
- 4. Normalize font features
9
+ 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
10
+ 2. Remove default margins and padding
11
+ 3. Reset all borders.
12
12
  */
13
13
 
14
- :root {
15
- line-height: 1.5; /* 1 */
16
- text-size-adjust: 100%; /* 2: -webkit-text-size-adjust */
17
- tab-size: 4; /* 3: -moz-tab-size */
18
- font-feature-settings: normal; /* 4 */
19
- font-variation-settings: normal; /* 4 */
14
+ *,
15
+ ::after,
16
+ ::before,
17
+ ::backdrop,
18
+ ::file-selector-button {
19
+ box-sizing: border-box; /* 1 */
20
+ margin: 0; /* 2 */
21
+ padding: 0; /* 2 */
22
+ border: 0 solid; /* 3 */
20
23
  }
21
24
 
22
25
  /*
23
- 1. Remove the margin in all browsers.
24
- 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
26
+ 1. Use a consistent sensible line-height in all browsers.
27
+ 2. Prevent adjustments of font size after orientation changes in iOS.
28
+ 3. Use a more readable tab size.
29
+
30
+ 4. REMOVED: Use the user's configured `sans` font-family by default.
31
+ 5. REMOVED: Use the user's configured `sans` font-feature-settings by default.
32
+ 6. REMOVED: Use the user's configured `sans` font-variation-settings by default.
33
+
34
+ 7. Disable tap highlights on iOS.
25
35
  */
26
36
 
27
- body {
28
- margin: 0; /* 1 */
29
- line-height: inherit; /* 2 */
37
+ :root,
38
+ :host {
39
+ line-height: 1.5; /* 1 */
40
+ -webkit-text-size-adjust: 100%; /* 2 */
41
+ text-size-adjust: 100%; /* 2 */
42
+ tab-size: 4; /* 3: -moz-tab-size */
43
+ -webkit-tap-highlight-color: transparent; /* 7 */
30
44
  }
31
45
 
32
46
  /*
33
- 1. Add the correct height in Firefox.
34
- 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
35
- 3. Ensure horizontal rules are visible by default.
47
+ 1. Add the correct height in Firefox.
48
+ 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
49
+ 3. Reset the default border style to a 1px solid border.
36
50
  */
37
51
 
38
52
  hr {
@@ -42,15 +56,16 @@ hr {
42
56
  }
43
57
 
44
58
  /*
45
- Add the correct text decoration in Chrome, Edge, and Safari.
59
+ Add the correct text decoration in Chrome, Edge, and Safari.
46
60
  */
47
61
 
48
62
  abbr:where([title]) {
63
+ -webkit-text-decoration: underline dotted;
49
64
  text-decoration: underline dotted;
50
65
  }
51
66
 
52
67
  /*
53
- Remove the default font size and weight for headings.
68
+ Remove the default font size and weight for headings.
54
69
  */
55
70
 
56
71
  h1,
@@ -64,16 +79,17 @@ h6 {
64
79
  }
65
80
 
66
81
  /*
67
- Reset links to optimize for opt-in styling instead of opt-out.
82
+ Reset links to optimize for opt-in styling instead of opt-out.
68
83
  */
69
84
 
70
85
  a {
71
86
  color: inherit;
87
+ -webkit-text-decoration: inherit;
72
88
  text-decoration: inherit;
73
89
  }
74
90
 
75
91
  /*
76
- Add the correct font weight in Edge and Safari.
92
+ Add the correct font weight in Edge and Safari.
77
93
  */
78
94
 
79
95
  b,
@@ -82,20 +98,21 @@ strong {
82
98
  }
83
99
 
84
100
  /*
85
- 1. Correct the odd `em` font sizing in all browsers.
86
- 2. Use a web-safe monospace font.
101
+ 1. REMOVED: Use the user's configured mono font-family by default
102
+ 2. REMOVED: Use the user's configured `mono` font-feature-settings by default.
103
+ 3. REMOVED: Use the user's configured `mono` font-variation-settings by default.
104
+ 4. Correct the odd `em` font sizing in all browsers.
87
105
  */
88
106
 
89
107
  code,
90
108
  kbd,
91
109
  samp,
92
110
  pre {
93
- font-size: 1em; /* 1 */
94
- font-family: 'Courier New', Courier, monospace; /* 2 */
111
+ font-size: 1em; /* 4 */
95
112
  }
96
113
 
97
114
  /*
98
- Add the correct font size in all browsers.
115
+ Add the correct font size in all browsers.
99
116
  */
100
117
 
101
118
  small {
@@ -103,7 +120,7 @@ small {
103
120
  }
104
121
 
105
122
  /*
106
- Prevent `sub` and `sup` elements from affecting the line height in all browsers.
123
+ Prevent `sub` and `sup` elements from affecting the line height in all browsers.
107
124
  */
108
125
 
109
126
  sub,
@@ -123,9 +140,9 @@ sup {
123
140
  }
124
141
 
125
142
  /*
126
- 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)
127
- 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)
128
- 3. Remove gaps between table borders by default.
143
+ 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)
144
+ 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)
145
+ 3. Remove gaps between table borders by default.
129
146
  */
130
147
 
131
148
  table {
@@ -135,230 +152,224 @@ table {
135
152
  }
136
153
 
137
154
  /*
138
- 1. Change the font styles in all browsers.
139
- 2. Remove the margin in Firefox and Safari.
140
- 3. Remove default padding in all browsers.
155
+ Use the modern Firefox focus style for all focusable elements.
141
156
  */
142
157
 
143
- button,
144
- input,
145
- optgroup,
146
- select,
147
- textarea {
148
- font-family: inherit; /* 1 */
149
- font-feature-settings: inherit; /* 1 */
150
- font-variation-settings: inherit; /* 1 */
151
- font-size: 100%; /* 1 */
152
- font-weight: inherit; /* 1 */
153
- line-height: inherit; /* 1 */
154
- color: inherit; /* 1 */
155
- margin: 0; /* 2 */
156
- padding: 0; /* 3 */
158
+ :-moz-focusring {
159
+ outline: auto;
157
160
  }
158
161
 
159
162
  /*
160
- Remove the inheritance of text transform in Edge and Firefox.
163
+ Add the correct vertical alignment in Chrome and Firefox.
161
164
  */
162
165
 
163
- button,
164
- select {
165
- text-transform: none;
166
+ progress {
167
+ vertical-align: baseline;
166
168
  }
167
169
 
168
170
  /*
169
- 1. Correct the inability to style clickable types in iOS and Safari.
170
- 2. Remove default button styles.
171
+ Add the correct display in Chrome and Safari.
171
172
  */
172
173
 
173
- button,
174
- [type='button'],
175
- [type='reset'],
176
- [type='submit'] {
177
- appearance: button; /* -webkit-appearance */
178
- background-color: transparent; /* 2 */
179
- background-image: none; /* 2 */
174
+ summary {
175
+ display: list-item;
180
176
  }
181
177
 
182
178
  /*
183
- Use the modern Firefox focus style for all focusable elements.
179
+ Make lists unstyled by default.
184
180
  */
185
181
 
186
- :-moz-focusring {
187
- outline: auto;
182
+ ol,
183
+ ul,
184
+ menu {
185
+ list-style: none;
188
186
  }
189
187
 
190
188
  /*
191
- Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
189
+ 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
190
+ 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
191
+ This can trigger a poorly considered lint error in some tools but is included by design.
192
192
  */
193
193
 
194
- :-moz-ui-invalid {
195
- box-shadow: none;
194
+ img,
195
+ svg,
196
+ video,
197
+ canvas,
198
+ audio,
199
+ iframe,
200
+ embed,
201
+ object {
202
+ display: block; /* 1 */
203
+ vertical-align: middle; /* 2 */
196
204
  }
197
205
 
198
206
  /*
199
- Add the correct vertical alignment in Chrome and Firefox.
207
+ Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
200
208
  */
201
209
 
202
- progress {
203
- vertical-align: baseline;
210
+ img,
211
+ video {
212
+ max-width: 100%;
213
+ height: auto;
204
214
  }
205
215
 
206
216
  /*
207
- Correct the cursor style of increment and decrement buttons in Safari.
217
+ 1. Inherit font styles in all browsers.
218
+ 2. Remove border radius in all browsers.
219
+ 3. Remove background color in all browsers.
220
+ 4. Ensure consistent opacity for disabled states in all browsers.
208
221
  */
209
222
 
210
- ::-webkit-inner-spin-button,
211
- ::-webkit-outer-spin-button {
212
- height: auto;
223
+ button,
224
+ input,
225
+ select,
226
+ optgroup,
227
+ textarea,
228
+ ::file-selector-button {
229
+ font: inherit; /* 1 */
230
+ font-feature-settings: inherit; /* 1 */
231
+ font-variation-settings: inherit; /* 1 */
232
+ letter-spacing: inherit; /* 1 */
233
+ color: inherit; /* 1 */
234
+ border-radius: 0; /* 2 */
235
+ background-color: transparent; /* 3 */
236
+ opacity: 1; /* 4 */
213
237
  }
214
238
 
215
239
  /*
216
- 1. Correct the odd appearance in Chrome and Safari.
217
- 2. Correct the outline style in Safari.
240
+ Restore default font weight.
218
241
  */
219
242
 
220
- [type='search'] {
221
- appearance: textfield; /* -webkit-appearance */
222
- outline-offset: -2px; /* 2 */
243
+ :where(select:is([multiple], [size])) optgroup {
244
+ font-weight: bolder;
223
245
  }
224
246
 
225
247
  /*
226
- Remove the inner padding in Chrome and Safari on macOS.
248
+ Restore indentation.
227
249
  */
228
250
 
229
- ::-webkit-search-decoration {
230
- appearance: none; /* -webkit-appeaance */
251
+ :where(select:is([multiple], [size])) optgroup option {
252
+ padding-inline-start: 20px;
231
253
  }
232
254
 
233
255
  /*
234
- 1. Correct the inability to style clickable types in iOS and Safari.
235
- 2. Change font properties to `inherit` in Safari.
256
+ Restore space after button.
236
257
  */
237
258
 
238
- ::-webkit-file-upload-button {
239
- appearance: button; /* -webkit-appearance */
240
- font: inherit; /* 2 */
259
+ ::file-selector-button {
260
+ margin-inline-end: 4px;
241
261
  }
242
262
 
243
263
  /*
244
- Add the correct display in Chrome and Safari.
264
+ Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
245
265
  */
246
266
 
247
- summary {
248
- display: list-item;
267
+ ::placeholder {
268
+ opacity: 1;
249
269
  }
250
270
 
251
271
  /*
252
- Removes the default spacing and border for appropriate elements.
272
+ REMOVED: Set the default placeholder color to a semi-transparent version of the current text color in
273
+ browsers that do not crash when using `color-mix(…)` with `currentcolor`.
274
+ (https://github.com/tailwindlabs/tailwindcss/issues/17194)
275
+
276
+ https://github.com/tailwindlabs/tailwindcss/blob/88b9f15b65588a87c5b6b13316530b4aecbc1b0b/packages/tailwindcss/preflight.css#L291
253
277
  */
254
278
 
255
- blockquote,
256
- dl,
257
- dd,
258
- h1,
259
- h2,
260
- h3,
261
- h4,
262
- h5,
263
- h6,
264
- hr,
265
- figure,
266
- p,
267
- pre {
268
- margin: 0;
269
- }
279
+ /*
280
+ Prevent resizing textareas horizontally by default.
281
+ */
270
282
 
271
- fieldset {
272
- margin: 0;
273
- padding: 0;
283
+ textarea {
284
+ resize: vertical;
274
285
  }
275
286
 
276
- legend {
277
- padding: 0;
278
- }
287
+ /*
288
+ Remove the inner padding in Chrome and Safari on macOS.
289
+ */
279
290
 
280
- ol,
281
- ul,
282
- menu {
283
- list-style: none;
284
- margin: 0;
285
- padding: 0;
291
+ ::-webkit-search-decoration {
292
+ -webkit-appearance: none;
286
293
  }
287
294
 
288
295
  /*
289
- Reset default styling for dialogs.
296
+ 1. Ensure date/time inputs have the same height when empty in iOS Safari.
297
+ 2. Ensure text alignment can be changed on date/time inputs in iOS Safari.
290
298
  */
291
- dialog {
292
- padding: 0;
299
+
300
+ ::-webkit-date-and-time-value {
301
+ min-height: 1lh; /* 1 */
302
+ text-align: inherit; /* 2 */
293
303
  }
294
304
 
295
305
  /*
296
- Prevent resizing textareas horizontally by default.
306
+ Prevent height from changing on date/time inputs in macOS Safari when the input is set to `display: block`.
297
307
  */
298
308
 
299
- textarea {
300
- resize: vertical;
309
+ ::-webkit-datetime-edit {
310
+ display: inline-flex;
301
311
  }
302
312
 
303
313
  /*
304
- 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
305
- 2. Set the default placeholder color to gray.
314
+ Remove excess padding from pseudo-elements in date/time inputs to ensure consistent height across browsers.
306
315
  */
307
316
 
308
- input::placeholder,
309
- textarea::placeholder {
310
- opacity: 1; /* 1 */
311
- color: #9ca3af; /* 2 */
317
+ ::-webkit-datetime-edit-fields-wrapper {
318
+ padding: 0;
319
+ }
320
+
321
+ ::-webkit-datetime-edit,
322
+ ::-webkit-datetime-edit-year-field,
323
+ ::-webkit-datetime-edit-month-field,
324
+ ::-webkit-datetime-edit-day-field,
325
+ ::-webkit-datetime-edit-hour-field,
326
+ ::-webkit-datetime-edit-minute-field,
327
+ ::-webkit-datetime-edit-second-field,
328
+ ::-webkit-datetime-edit-millisecond-field,
329
+ ::-webkit-datetime-edit-meridiem-field {
330
+ padding-block: 0;
312
331
  }
313
332
 
314
333
  /*
315
- Set the default cursor for buttons.
334
+ Center dropdown marker shown on inputs with paired `<datalist>`s in Chrome. (https://github.com/tailwindlabs/tailwindcss/issues/18499)
316
335
  */
317
336
 
318
- button,
319
- [role='button'] {
320
- cursor: pointer;
337
+ ::-webkit-calendar-picker-indicator {
338
+ line-height: 1;
321
339
  }
322
340
 
323
341
  /*
324
- Make sure disabled buttons don't get the pointer cursor.
342
+ Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
325
343
  */
326
- :disabled {
327
- cursor: default;
344
+
345
+ :-moz-ui-invalid {
346
+ box-shadow: none;
328
347
  }
329
348
 
330
349
  /*
331
- 1. Make replaced elements `display: block` by default.
332
- (https://github.com/mozdevs/cssremedy/issues/14)
333
- 2. Add `vertical-align: middle` to align replaced elements more sensibly by default.
334
- (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
335
- This can trigger a poorly considered lint error in some tools but is included by design.
350
+ Correct the inability to style the border radius in iOS Safari.
336
351
  */
337
352
 
338
- img,
339
- svg,
340
- video,
341
- canvas,
342
- audio,
343
- iframe,
344
- embed,
345
- object {
346
- display: block; /* 1 */
347
- vertical-align: middle; /* 2 */
353
+ button,
354
+ input:where([type='button'], [type='reset'], [type='submit']),
355
+ ::file-selector-button {
356
+ appearance: button;
348
357
  }
349
358
 
350
359
  /*
351
- Constrain images and videos to the parent width and preserve their intrinsic aspect ratio.
352
- (https://github.com/mozdevs/cssremedy/issues/14)
360
+ Correct the cursor style of increment and decrement buttons in Safari.
353
361
  */
354
362
 
355
- img,
356
- video {
357
- max-width: 100%;
363
+ ::-webkit-inner-spin-button,
364
+ ::-webkit-outer-spin-button {
358
365
  height: auto;
359
366
  }
360
367
 
361
- /* Make elements with the HTML hidden attribute stay hidden by default */
362
- [hidden] {
363
- display: none;
368
+ /*
369
+ Make elements with the HTML hidden attribute stay hidden by default.
370
+ */
371
+
372
+ [hidden]:where(:not([hidden='until-found'])) {
373
+ /* eslint-disable-next-line */
374
+ display: none !important;
364
375
  }