autoprefixer 9.4.9 → 9.6.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/CHANGELOG.md +17 -0
- package/README.md +240 -246
- package/data/prefixes.js +14 -2
- package/lib/autoprefixer.js +19 -3
- package/lib/hacks/backdrop-filter.js +37 -0
- package/lib/hacks/background-clip.js +1 -5
- package/lib/hacks/border-radius.js +2 -5
- package/lib/hacks/cross-fade.js +2 -2
- package/lib/hacks/flex.js +2 -2
- package/lib/hacks/gradient.js +6 -6
- package/lib/hacks/mask-composite.js +106 -0
- package/lib/prefixer.js +4 -6
- package/lib/prefixes.js +4 -2
- package/lib/processor.js +5 -0
- package/lib/resolution.js +4 -4
- package/lib/supports.js +4 -4
- package/lib/value.js +2 -2
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -14,6 +14,15 @@ entirely):
|
|
|
14
14
|
::placeholder {
|
|
15
15
|
color: gray;
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
.image {
|
|
19
|
+
background-image: url(image@1x.png);
|
|
20
|
+
}
|
|
21
|
+
@media (min-resolution: 2dppx) {
|
|
22
|
+
.image {
|
|
23
|
+
background-image: url(image@2x.png);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
17
26
|
```
|
|
18
27
|
|
|
19
28
|
Autoprefixer will use the data based on current browser popularity and property
|
|
@@ -24,6 +33,9 @@ of Autoprefixer.
|
|
|
24
33
|
::-webkit-input-placeholder {
|
|
25
34
|
color: gray;
|
|
26
35
|
}
|
|
36
|
+
::-moz-placeholder {
|
|
37
|
+
color: gray;
|
|
38
|
+
}
|
|
27
39
|
:-ms-input-placeholder {
|
|
28
40
|
color: gray;
|
|
29
41
|
}
|
|
@@ -33,6 +45,17 @@ of Autoprefixer.
|
|
|
33
45
|
::placeholder {
|
|
34
46
|
color: gray;
|
|
35
47
|
}
|
|
48
|
+
|
|
49
|
+
.image {
|
|
50
|
+
background-image: url(image@1x.png);
|
|
51
|
+
}
|
|
52
|
+
@media (-webkit-min-device-pixel-ratio: 2),
|
|
53
|
+
(-o-min-device-pixel-ratio: 2/1),
|
|
54
|
+
(min-resolution: 2dppx) {
|
|
55
|
+
.image {
|
|
56
|
+
background-image: url(image@2x.png);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
36
59
|
```
|
|
37
60
|
|
|
38
61
|
Twitter account for news and releases: [@autoprefixer].
|
|
@@ -55,8 +78,6 @@ Twitter account for news and releases: [@autoprefixer].
|
|
|
55
78
|
- [Browsers](#browsers)
|
|
56
79
|
- [FAQ](#faq)
|
|
57
80
|
- [Does Autoprefixer polyfill Grid Layout for IE?](#does-autoprefixer-polyfill-grid-layout-for-ie)
|
|
58
|
-
- [No prefixes in production](#no-prefixes-in-production)
|
|
59
|
-
- [What is the unprefixed version of `-webkit-min-device-pixel-ratio`?](#what-is-the-unprefixed-version-of--webkit-min-device-pixel-ratio)
|
|
60
81
|
- [Does it add polyfills?](#does-it-add-polyfills)
|
|
61
82
|
- [Why doesn’t Autoprefixer add prefixes to `border-radius`?](#why-doesnt-autoprefixer-add-prefixes-to-border-radius)
|
|
62
83
|
- [Why does Autoprefixer use unprefixed properties in `@-webkit-keyframes`?](#why-does-autoprefixer-use-unprefixed-properties-in--webkit-keyframes)
|
|
@@ -103,40 +124,45 @@ See [Browserslist docs] for queries, browser names, config format, and defaults.
|
|
|
103
124
|
|
|
104
125
|
### Does Autoprefixer polyfill Grid Layout for IE?
|
|
105
126
|
|
|
106
|
-
Autoprefixer can be used to translate modern CSS Grid syntax into IE 10
|
|
107
|
-
but this polyfill will not work in 100% of cases.
|
|
127
|
+
Autoprefixer can be used to translate modern CSS Grid syntax into IE 10
|
|
128
|
+
and IE 11 syntax, but this polyfill will not work in 100% of cases.
|
|
129
|
+
This is why it is disabled by default.
|
|
108
130
|
|
|
109
|
-
First, you need to enable Grid prefixes by using either the `grid: "autoplace"`
|
|
131
|
+
First, you need to enable Grid prefixes by using either the `grid: "autoplace"`
|
|
132
|
+
option or the `/* autoprefixer grid: autoplace */` control comment.
|
|
110
133
|
|
|
111
134
|
Second, you need to test every fix with Grid in IE. It is not an enable and
|
|
112
135
|
forget feature, but it is still very useful.
|
|
113
136
|
Financial Times and Yandex use it in production.
|
|
114
137
|
|
|
115
|
-
Third, there is only very limited auto placement support. Read the
|
|
138
|
+
Third, there is only very limited auto placement support. Read the
|
|
139
|
+
[Grid Autoplacement support in IE](#grid-autoplacement-support-in-ie) section
|
|
140
|
+
for more details.
|
|
116
141
|
|
|
117
|
-
Fourth, if you are not using the autoplacement feature, the best way
|
|
142
|
+
Fourth, if you are not using the autoplacement feature, the best way
|
|
143
|
+
to use Autoprefixer is by using `grid-template` or `grid-template-areas`.
|
|
118
144
|
|
|
119
145
|
```css
|
|
120
146
|
.page {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
147
|
+
display: grid;
|
|
148
|
+
grid-gap: 33px;
|
|
149
|
+
grid-template:
|
|
150
|
+
"head head head" 1fr
|
|
151
|
+
"nav main main" minmax(100px, 1fr)
|
|
152
|
+
"nav foot foot" 2fr /
|
|
153
|
+
1fr 100px 1fr;
|
|
128
154
|
}
|
|
129
155
|
.page__head {
|
|
130
|
-
|
|
156
|
+
grid-area: head;
|
|
131
157
|
}
|
|
132
158
|
.page__nav {
|
|
133
|
-
|
|
159
|
+
grid-area: nav;
|
|
134
160
|
}
|
|
135
161
|
.page__main {
|
|
136
|
-
|
|
162
|
+
grid-area: main;
|
|
137
163
|
}
|
|
138
164
|
.page__footer {
|
|
139
|
-
|
|
165
|
+
grid-area: foot;
|
|
140
166
|
}
|
|
141
167
|
```
|
|
142
168
|
|
|
@@ -152,44 +178,6 @@ See also:
|
|
|
152
178
|
[`postcss-gap-properties`]: https://github.com/jonathantneal/postcss-gap-properties
|
|
153
179
|
[`postcss-grid-kiss`]: https://github.com/sylvainpolletvillard/postcss-grid-kiss
|
|
154
180
|
|
|
155
|
-
### No prefixes in production
|
|
156
|
-
|
|
157
|
-
Many other tools contain Autoprefixer. For example, webpack uses Autoprefixer
|
|
158
|
-
to minify CSS by cleaning unnecessary prefixes.
|
|
159
|
-
|
|
160
|
-
If you pass your browsers to Autoprefixer using its `browsers` option, the other
|
|
161
|
-
tools will use their own config, leading webpack to remove the prefixes that
|
|
162
|
-
the first Autoprefixer added.
|
|
163
|
-
|
|
164
|
-
To avoid this, ensure you use either the [browserslist config file] or
|
|
165
|
-
`browsers` key in your `package.json`, so that all tools (Autoprefixer,
|
|
166
|
-
cssnano, doiuse, cssnext, etc) use the same browsers list.
|
|
167
|
-
|
|
168
|
-
[browserslist config file]: https://github.com/ai/browserslist#config-file
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
### What is the unprefixed version of `-webkit-min-device-pixel-ratio`?
|
|
172
|
-
|
|
173
|
-
```css
|
|
174
|
-
@media (min-resolution: 2dppx) {
|
|
175
|
-
.image {
|
|
176
|
-
background-image: url(image@2x.png);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Will be compiled to:
|
|
182
|
-
|
|
183
|
-
```css
|
|
184
|
-
@media (-webkit-min-device-pixel-ratio: 2),
|
|
185
|
-
(-o-min-device-pixel-ratio: 2/1),
|
|
186
|
-
(min-resolution: 2dppx) {
|
|
187
|
-
.image {
|
|
188
|
-
background-image: url(image@2x.png);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
181
|
|
|
194
182
|
### Does it add polyfills?
|
|
195
183
|
|
|
@@ -242,8 +230,7 @@ Use [postcss-unprefix] before Autoprefixer.
|
|
|
242
230
|
### Does Autoprefixer add `-epub-` prefix?
|
|
243
231
|
|
|
244
232
|
No, Autoprefixer works only with browsers prefixes from Can I Use.
|
|
245
|
-
But you can use [postcss-epub]
|
|
246
|
-
for prefixing ePub3 properties.
|
|
233
|
+
But you can use [postcss-epub] for prefixing ePub3 properties.
|
|
247
234
|
|
|
248
235
|
[postcss-epub]: https://github.com/Rycochet/postcss-epub
|
|
249
236
|
|
|
@@ -264,17 +251,17 @@ future-proof. You can use [postcss-font-family-system-ui] to transform
|
|
|
264
251
|
In Gulp you can use [gulp-postcss] with `autoprefixer` npm package.
|
|
265
252
|
|
|
266
253
|
```js
|
|
267
|
-
gulp.task('autoprefixer',
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
})
|
|
254
|
+
gulp.task('autoprefixer', () => {
|
|
255
|
+
const autoprefixer = require('autoprefixer')
|
|
256
|
+
const sourcemaps = require('gulp-sourcemaps')
|
|
257
|
+
const postcss = require('gulp-postcss')
|
|
258
|
+
|
|
259
|
+
return gulp.src('./src/*.css')
|
|
260
|
+
.pipe(sourcemaps.init())
|
|
261
|
+
.pipe(postcss([ autoprefixer() ]))
|
|
262
|
+
.pipe(sourcemaps.write('.'))
|
|
263
|
+
.pipe(gulp.dest('./dest'))
|
|
264
|
+
})
|
|
278
265
|
```
|
|
279
266
|
|
|
280
267
|
With `gulp-postcss` you also can combine Autoprefixer
|
|
@@ -291,14 +278,14 @@ and [other PostCSS plugins].
|
|
|
291
278
|
|
|
292
279
|
```js
|
|
293
280
|
module.exports = {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
281
|
+
module: {
|
|
282
|
+
rules: [
|
|
283
|
+
{
|
|
284
|
+
test: /\.css$/,
|
|
285
|
+
use: ["style-loader", "css-loader", "postcss-loader"]
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
}
|
|
302
289
|
}
|
|
303
290
|
```
|
|
304
291
|
|
|
@@ -314,7 +301,7 @@ module.exports = {
|
|
|
314
301
|
|
|
315
302
|
[other PostCSS plugins]: https://github.com/postcss/postcss#plugins
|
|
316
303
|
[postcss-loader]: https://github.com/postcss/postcss-loader
|
|
317
|
-
[webpack]:
|
|
304
|
+
[webpack]: https://webpack.js.org/
|
|
318
305
|
|
|
319
306
|
|
|
320
307
|
### CSS-in-JS
|
|
@@ -409,15 +396,15 @@ You can use Autoprefixer with [PostCSS] in your Node.js application
|
|
|
409
396
|
or if you want to develop an Autoprefixer plugin for a new environment.
|
|
410
397
|
|
|
411
398
|
```js
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
postcss([ autoprefixer ]).process(css).then(
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
})
|
|
399
|
+
const autoprefixer = require('autoprefixer')
|
|
400
|
+
const postcss = require('postcss')
|
|
401
|
+
|
|
402
|
+
postcss([ autoprefixer ]).process(css).then(result => {
|
|
403
|
+
result.warnings().forEach(warn => {
|
|
404
|
+
console.warn(warn.toString())
|
|
405
|
+
})
|
|
406
|
+
console.log(result.css)
|
|
407
|
+
})
|
|
421
408
|
```
|
|
422
409
|
|
|
423
410
|
There is also a [standalone build] for the browser or for a non-Node.js runtime.
|
|
@@ -435,7 +422,7 @@ Autoprefixer should be used in assets build tools. Text editor plugins are not
|
|
|
435
422
|
a good solution, because prefixes decrease code readability and you will need
|
|
436
423
|
to change values in all prefixed properties.
|
|
437
424
|
|
|
438
|
-
I recommend you to learn how to use build tools like [
|
|
425
|
+
I recommend you to learn how to use build tools like [Parcel].
|
|
439
426
|
They work much better and will open you a whole new world of useful plugins
|
|
440
427
|
and automation.
|
|
441
428
|
|
|
@@ -445,8 +432,9 @@ If you can’t move to a build tool, you can use text editor plugins:
|
|
|
445
432
|
* [Brackets](https://github.com/mikaeljorhult/brackets-autoprefixer)
|
|
446
433
|
* [Atom Editor](https://github.com/sindresorhus/atom-autoprefixer)
|
|
447
434
|
* [Visual Studio](https://github.com/madskristensen/WebCompiler)
|
|
435
|
+
([how to](https://stackoverflow.com/a/54908636/2440))
|
|
448
436
|
|
|
449
|
-
[
|
|
437
|
+
[Parcel]: https://parceljs.org/
|
|
450
438
|
|
|
451
439
|
|
|
452
440
|
## Warnings
|
|
@@ -461,9 +449,9 @@ problems in your CSS:
|
|
|
461
449
|
You can get warnings from `result.warnings()`:
|
|
462
450
|
|
|
463
451
|
```js
|
|
464
|
-
result.warnings().forEach(
|
|
465
|
-
|
|
466
|
-
})
|
|
452
|
+
result.warnings().forEach(warn => {
|
|
453
|
+
console.warn(warn.toString())
|
|
454
|
+
})
|
|
467
455
|
```
|
|
468
456
|
|
|
469
457
|
Every Autoprefixer runner should display these warnings.
|
|
@@ -481,8 +469,8 @@ after the unprefixed one.
|
|
|
481
469
|
|
|
482
470
|
```css
|
|
483
471
|
a {
|
|
484
|
-
|
|
485
|
-
|
|
472
|
+
transform: scale(0.5);
|
|
473
|
+
-moz-transform: scale(0.6);
|
|
486
474
|
}
|
|
487
475
|
```
|
|
488
476
|
|
|
@@ -506,7 +494,7 @@ You can use these plugin options to control some of Autoprefixer’s features.
|
|
|
506
494
|
You should set them inside the plugin like so:
|
|
507
495
|
|
|
508
496
|
```js
|
|
509
|
-
autoprefixer({ grid:
|
|
497
|
+
autoprefixer({ grid: 'autoplace' })
|
|
510
498
|
```
|
|
511
499
|
|
|
512
500
|
|
|
@@ -517,18 +505,18 @@ you can use control comments to disable Autoprefixer.
|
|
|
517
505
|
|
|
518
506
|
```css
|
|
519
507
|
.a {
|
|
520
|
-
|
|
508
|
+
transition: 1s; /* will be prefixed */
|
|
521
509
|
}
|
|
522
510
|
|
|
523
511
|
.b {
|
|
524
|
-
|
|
525
|
-
|
|
512
|
+
/* autoprefixer: off */
|
|
513
|
+
transition: 1s; /* will not be prefixed */
|
|
526
514
|
}
|
|
527
515
|
|
|
528
516
|
.c {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
517
|
+
/* autoprefixer: ignore next */
|
|
518
|
+
transition: 1s; /* will not be prefixed */
|
|
519
|
+
mask: url(image.png); /* will be prefixed */
|
|
532
520
|
}
|
|
533
521
|
```
|
|
534
522
|
|
|
@@ -540,20 +528,20 @@ There are three types of control comments:
|
|
|
540
528
|
or next rule selector or at-rule parameters (but not rule/at‑rule body).
|
|
541
529
|
* `/* autoprefixer grid: (autoplace|no-autoplace|off) */`: control how Autoprefixer handles
|
|
542
530
|
grid translations for the whole block:
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
531
|
+
* `autoplace`: enable grid translations with autoplacement support.
|
|
532
|
+
* `no-autoplace`: enable grid translations with autoplacement
|
|
533
|
+
support *disabled* (alias for deprecated value `on`).
|
|
534
|
+
* `off`: disable all grid translations.
|
|
547
535
|
|
|
548
536
|
You can also use comments recursively:
|
|
549
537
|
|
|
550
538
|
```css
|
|
551
539
|
/* autoprefixer: off */
|
|
552
540
|
@supports (transition: all) {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
541
|
+
/* autoprefixer: on */
|
|
542
|
+
a {
|
|
543
|
+
/* autoprefixer: off */
|
|
544
|
+
}
|
|
557
545
|
}
|
|
558
546
|
```
|
|
559
547
|
|
|
@@ -564,10 +552,10 @@ block twice:
|
|
|
564
552
|
/* How not to use block level control comments */
|
|
565
553
|
|
|
566
554
|
.do-not-do-this {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
555
|
+
/* autoprefixer: off */
|
|
556
|
+
transition: 1s;
|
|
557
|
+
/* autoprefixer: on */
|
|
558
|
+
transform: rotate(20deg);
|
|
571
559
|
}
|
|
572
560
|
```
|
|
573
561
|
|
|
@@ -593,24 +581,27 @@ Available options are:
|
|
|
593
581
|
parameters. Default is `true`.
|
|
594
582
|
* `flexbox` (boolean|string): should Autoprefixer add prefixes for flexbox
|
|
595
583
|
properties. With `"no-2009"` value Autoprefixer will add prefixes only
|
|
596
|
-
for final and IE versions of specification. Default is `true`.
|
|
597
|
-
* `grid` (false|"autoplace"|"no-autoplace"): should Autoprefixer
|
|
598
|
-
properties?
|
|
599
|
-
* `false` (default): prevent Autoprefixer from outputting
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
584
|
+
for final and IE 10 versions of specification. Default is `true`.
|
|
585
|
+
* `grid` (false|"autoplace"|"no-autoplace"): should Autoprefixer
|
|
586
|
+
add IE 10-11 prefixes for Grid Layout properties?
|
|
587
|
+
* `false` (default): prevent Autoprefixer from outputting
|
|
588
|
+
CSS Grid translations.
|
|
589
|
+
* `"autoplace"`: enable Autoprefixer grid translations
|
|
590
|
+
and *include* autoplacement support. You can also use
|
|
591
|
+
`/* autoprefixer grid: autoplace */` in your CSS.
|
|
592
|
+
* `"no-autoplace"`: enable Autoprefixer grid translations
|
|
593
|
+
but *exclude* autoplacement support. You can also use
|
|
594
|
+
`/* autoprefixer grid: no-autoplace */` in your CSS.
|
|
604
595
|
(alias for the deprecated `true` value)
|
|
605
596
|
* `stats` (object): custom [usage statistics] for `> 10% in my stats`
|
|
606
597
|
browsers query.
|
|
607
|
-
* `
|
|
608
|
-
|
|
598
|
+
* `overrideBrowserslist` (array): list of queries for target browsers.
|
|
599
|
+
Try to not use it. The best practice is to use `.browserslistrc` config
|
|
609
600
|
or `browserslist` key in `package.json` to share target browsers
|
|
610
601
|
with Babel, ESLint and Stylelint. See [Browserslist docs]
|
|
611
602
|
for available queries and default value.
|
|
612
603
|
* `ignoreUnknownVersions` (boolean): do not raise error on unknown browser
|
|
613
|
-
version in Browserslist config
|
|
604
|
+
version in Browserslist config. Default is `false`.
|
|
614
605
|
|
|
615
606
|
Plugin object has `info()` method for debugging purpose.
|
|
616
607
|
|
|
@@ -634,10 +625,10 @@ Autoprefixer supports autoplacement by using `nth-child` CSS selectors. It creat
|
|
|
634
625
|
/* autoprefixer grid: autoplace */
|
|
635
626
|
|
|
636
627
|
.autoplacement-example {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
628
|
+
display: grid;
|
|
629
|
+
grid-template-columns: 1fr 1fr;
|
|
630
|
+
grid-template-rows: auto auto;
|
|
631
|
+
grid-gap: 20px;
|
|
641
632
|
}
|
|
642
633
|
```
|
|
643
634
|
|
|
@@ -647,33 +638,33 @@ Autoprefixer supports autoplacement by using `nth-child` CSS selectors. It creat
|
|
|
647
638
|
/* autoprefixer grid: autoplace */
|
|
648
639
|
|
|
649
640
|
.autoplacement-example {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
641
|
+
display: -ms-grid;
|
|
642
|
+
display: grid;
|
|
643
|
+
-ms-grid-columns: 1fr 20px 1fr;
|
|
644
|
+
grid-template-columns: 1fr 1fr;
|
|
645
|
+
-ms-grid-rows: auto 20px auto;
|
|
646
|
+
grid-template-rows: auto auto;
|
|
647
|
+
grid-gap: 20px;
|
|
657
648
|
}
|
|
658
649
|
|
|
659
650
|
.autoplacement-example > *:nth-child(1) {
|
|
660
|
-
|
|
661
|
-
|
|
651
|
+
-ms-grid-row: 1;
|
|
652
|
+
-ms-grid-column: 1;
|
|
662
653
|
}
|
|
663
654
|
|
|
664
655
|
.autoplacement-example > *:nth-child(2) {
|
|
665
|
-
|
|
666
|
-
|
|
656
|
+
-ms-grid-row: 1;
|
|
657
|
+
-ms-grid-column: 3;
|
|
667
658
|
}
|
|
668
659
|
|
|
669
660
|
.autoplacement-example > *:nth-child(3) {
|
|
670
|
-
|
|
671
|
-
|
|
661
|
+
-ms-grid-row: 3;
|
|
662
|
+
-ms-grid-column: 1;
|
|
672
663
|
}
|
|
673
664
|
|
|
674
665
|
.autoplacement-example > *:nth-child(4) {
|
|
675
|
-
|
|
676
|
-
|
|
666
|
+
-ms-grid-row: 3;
|
|
667
|
+
-ms-grid-column: 3;
|
|
677
668
|
}
|
|
678
669
|
```
|
|
679
670
|
|
|
@@ -696,14 +687,14 @@ The following CSS will not work as expected with the autoplacement feature enabl
|
|
|
696
687
|
/* Unsafe CSS when Autoplacement is enabled */
|
|
697
688
|
|
|
698
689
|
.grid-cell {
|
|
699
|
-
|
|
700
|
-
|
|
690
|
+
grid-column: 2;
|
|
691
|
+
grid-row: 2;
|
|
701
692
|
}
|
|
702
693
|
|
|
703
694
|
.grid {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
695
|
+
display: grid;
|
|
696
|
+
grid-template-columns: repeat(3, 1fr);
|
|
697
|
+
grid-template-rows: repeat(3, 1fr);
|
|
707
698
|
}
|
|
708
699
|
```
|
|
709
700
|
|
|
@@ -713,14 +704,14 @@ Swapping the rules around will not fix the issue either:
|
|
|
713
704
|
/* Also unsafe to use this CSS */
|
|
714
705
|
|
|
715
706
|
.grid {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
707
|
+
display: grid;
|
|
708
|
+
grid-template-columns: repeat(3, 1fr);
|
|
709
|
+
grid-template-rows: repeat(3, 1fr);
|
|
719
710
|
}
|
|
720
711
|
|
|
721
712
|
.grid-cell {
|
|
722
|
-
|
|
723
|
-
|
|
713
|
+
grid-column: 2;
|
|
714
|
+
grid-row: 2;
|
|
724
715
|
}
|
|
725
716
|
```
|
|
726
717
|
|
|
@@ -731,15 +722,15 @@ grid-declaration rule:
|
|
|
731
722
|
/* Disable autoplacement to fix the issue */
|
|
732
723
|
|
|
733
724
|
.grid {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
725
|
+
/* autoprefixer grid: no-autoplace */
|
|
726
|
+
display: grid;
|
|
727
|
+
grid-template-columns: repeat(3, 1fr);
|
|
728
|
+
grid-template-rows: repeat(3, 1fr);
|
|
738
729
|
}
|
|
739
730
|
|
|
740
731
|
.grid-cell {
|
|
741
|
-
|
|
742
|
-
|
|
732
|
+
grid-column: 2;
|
|
733
|
+
grid-row: 2;
|
|
743
734
|
}
|
|
744
735
|
```
|
|
745
736
|
|
|
@@ -753,21 +744,21 @@ when needed. This method is far less likely to cause something on the site to br
|
|
|
753
744
|
|
|
754
745
|
/* Old code will function the same way it always has */
|
|
755
746
|
.old-grid {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
747
|
+
display: grid;
|
|
748
|
+
grid-template-columns: repeat(3, 1fr);
|
|
749
|
+
grid-template-rows: repeat(3, 1fr);
|
|
759
750
|
}
|
|
760
751
|
.old-grid-cell {
|
|
761
|
-
|
|
762
|
-
|
|
752
|
+
grid-column: 2;
|
|
753
|
+
grid-row: 2;
|
|
763
754
|
}
|
|
764
755
|
|
|
765
756
|
/* Enable autoplacement when you want to use it in new code */
|
|
766
757
|
.new-autoplace-friendly-grid {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
758
|
+
/* autoprefixer grid: autoplace */
|
|
759
|
+
display: grid;
|
|
760
|
+
grid-template-columns: repeat(3, 1fr);
|
|
761
|
+
grid-template-rows: repeat(3, auto);
|
|
771
762
|
}
|
|
772
763
|
```
|
|
773
764
|
|
|
@@ -786,14 +777,14 @@ so that Autoprefixer knows how many `nth-child` selectors to generate.
|
|
|
786
777
|
|
|
787
778
|
```css
|
|
788
779
|
.not-allowed {
|
|
789
|
-
|
|
790
|
-
|
|
780
|
+
display: grid;
|
|
781
|
+
grid-template-columns: repeat(3, 1fr);
|
|
791
782
|
}
|
|
792
783
|
|
|
793
784
|
.is-allowed {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
785
|
+
display: grid;
|
|
786
|
+
grid-template-columns: repeat(3, 1fr);
|
|
787
|
+
grid-template-rows: repeat(10, auto);
|
|
797
788
|
}
|
|
798
789
|
```
|
|
799
790
|
|
|
@@ -806,42 +797,38 @@ so unfortunately this little snippet will _never_ be IE friendly.
|
|
|
806
797
|
|
|
807
798
|
```css
|
|
808
799
|
.grid {
|
|
809
|
-
|
|
810
|
-
|
|
800
|
+
/* This will never be IE friendly */
|
|
801
|
+
grid-template-columns: repeat(auto-fit, min-max(200px, 1fr))
|
|
811
802
|
}
|
|
812
803
|
```
|
|
813
804
|
|
|
814
805
|
#### No manual cell placement or column/row spans allowed inside an autoplacement grid
|
|
815
806
|
|
|
816
|
-
Elements must not be manually placed or given column/row spans inside
|
|
817
|
-
grid. Only the most basic of autoplacement grids are supported.
|
|
818
|
-
placed manually outside the the explicit grid though.
|
|
819
|
-
individual grid cells inside an explicit
|
|
820
|
-
future release.
|
|
807
|
+
Elements must not be manually placed or given column/row spans inside
|
|
808
|
+
an autoplacement grid. Only the most basic of autoplacement grids are supported.
|
|
809
|
+
Grid cells can still be placed manually outside the the explicit grid though.
|
|
810
|
+
Support for manually placing individual grid cells inside an explicit
|
|
811
|
+
autoplacement grid is planned for a future release.
|
|
821
812
|
|
|
822
813
|
```css
|
|
823
814
|
.autoplacement-grid {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
815
|
+
display: grid;
|
|
816
|
+
grid-template-columns: repeat(3, 1fr);
|
|
817
|
+
grid-template-rows: repeat(3, auto);
|
|
827
818
|
}
|
|
828
819
|
|
|
829
|
-
/*
|
|
830
|
-
|
|
831
|
-
will break the layout in IE
|
|
832
|
-
*/
|
|
820
|
+
/* Grid cells placed inside the explicit grid
|
|
821
|
+
will break the layout in IE */
|
|
833
822
|
.not-permitted-grid-cell {
|
|
834
|
-
|
|
835
|
-
|
|
823
|
+
grid-column: 1;
|
|
824
|
+
grid-row: 1;
|
|
836
825
|
}
|
|
837
826
|
|
|
838
|
-
/*
|
|
839
|
-
|
|
840
|
-
explicit grid will work in IE
|
|
841
|
-
*/
|
|
827
|
+
/* Grid cells placed outside the
|
|
828
|
+
explicit grid will work in IE */
|
|
842
829
|
.permitted-grid-cell {
|
|
843
|
-
|
|
844
|
-
|
|
830
|
+
grid-column: 1 / span 2;
|
|
831
|
+
grid-row: 4;
|
|
845
832
|
}
|
|
846
833
|
```
|
|
847
834
|
|
|
@@ -850,25 +837,25 @@ If manual cell placement is required, we recommend using `grid-template` or
|
|
|
850
837
|
|
|
851
838
|
```css
|
|
852
839
|
.page {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
840
|
+
display: grid;
|
|
841
|
+
grid-gap: 30px;
|
|
842
|
+
grid-template:
|
|
843
|
+
"head head"
|
|
844
|
+
"nav main" minmax(100px, 1fr)
|
|
845
|
+
"foot foot" /
|
|
846
|
+
200px 1fr;
|
|
860
847
|
}
|
|
861
848
|
.page__head {
|
|
862
|
-
|
|
849
|
+
grid-area: head;
|
|
863
850
|
}
|
|
864
851
|
.page__nav {
|
|
865
|
-
|
|
852
|
+
grid-area: nav;
|
|
866
853
|
}
|
|
867
854
|
.page__main {
|
|
868
|
-
|
|
855
|
+
grid-area: main;
|
|
869
856
|
}
|
|
870
857
|
.page__footer {
|
|
871
|
-
|
|
858
|
+
grid-area: foot;
|
|
872
859
|
}
|
|
873
860
|
```
|
|
874
861
|
|
|
@@ -878,7 +865,7 @@ Let's say you have this HTML:
|
|
|
878
865
|
|
|
879
866
|
```html
|
|
880
867
|
<div class="grid">
|
|
881
|
-
|
|
868
|
+
<div class="grid-cell"></div>
|
|
882
869
|
</div>
|
|
883
870
|
```
|
|
884
871
|
|
|
@@ -886,17 +873,17 @@ And you write this CSS:
|
|
|
886
873
|
|
|
887
874
|
```css
|
|
888
875
|
.grid {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
876
|
+
display: grid;
|
|
877
|
+
grid-template-columns: 1fr 1fr;
|
|
878
|
+
grid-template-rows: auto;
|
|
892
879
|
}
|
|
893
880
|
|
|
894
881
|
.grid::before {
|
|
895
|
-
|
|
882
|
+
content: 'before';
|
|
896
883
|
}
|
|
897
884
|
|
|
898
885
|
.grid::after {
|
|
899
|
-
|
|
886
|
+
content: 'after';
|
|
900
887
|
}
|
|
901
888
|
```
|
|
902
889
|
|
|
@@ -904,31 +891,31 @@ This will be the output:
|
|
|
904
891
|
|
|
905
892
|
```css
|
|
906
893
|
.grid {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
894
|
+
display: -ms-grid;
|
|
895
|
+
display: grid;
|
|
896
|
+
-ms-grid-columns: 1fr 1fr;
|
|
897
|
+
grid-template-columns: 1fr 1fr;
|
|
898
|
+
-ms-grid-rows: auto;
|
|
899
|
+
grid-template-rows: auto;
|
|
913
900
|
}
|
|
914
901
|
|
|
915
902
|
.grid > *:nth-child(1) {
|
|
916
|
-
|
|
917
|
-
|
|
903
|
+
-ms-grid-row: 1;
|
|
904
|
+
-ms-grid-column: 1;
|
|
918
905
|
}
|
|
919
906
|
|
|
920
907
|
|
|
921
908
|
.grid > *:nth-child(2) {
|
|
922
|
-
|
|
923
|
-
|
|
909
|
+
-ms-grid-row: 1;
|
|
910
|
+
-ms-grid-column: 2;
|
|
924
911
|
}
|
|
925
912
|
|
|
926
913
|
.grid::before {
|
|
927
|
-
|
|
914
|
+
content: 'before';
|
|
928
915
|
}
|
|
929
916
|
|
|
930
917
|
.grid::after {
|
|
931
|
-
|
|
918
|
+
content: 'after';
|
|
932
919
|
}
|
|
933
920
|
```
|
|
934
921
|
|
|
@@ -948,47 +935,47 @@ If you wish to change the size of a `grid-gap`, you will need to redeclare the g
|
|
|
948
935
|
|
|
949
936
|
```css
|
|
950
937
|
.grid {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
938
|
+
display: grid;
|
|
939
|
+
grid-template-columns: 1fr 1fr;
|
|
940
|
+
grid-template-rows: auto;
|
|
941
|
+
grid-gap: 50px;
|
|
955
942
|
}
|
|
956
943
|
|
|
957
944
|
/* This will *NOT* work in IE */
|
|
958
945
|
@media (max-width: 600px) {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
946
|
+
.grid {
|
|
947
|
+
grid-gap: 20px;
|
|
948
|
+
}
|
|
962
949
|
}
|
|
963
950
|
|
|
964
951
|
/* This will *NOT* work in IE */
|
|
965
952
|
.grid.small-gap {
|
|
966
|
-
|
|
953
|
+
grid-gap: 20px;
|
|
967
954
|
}
|
|
968
955
|
```
|
|
969
956
|
|
|
970
957
|
```css
|
|
971
958
|
.grid {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
959
|
+
display: grid;
|
|
960
|
+
grid-template-columns: 1fr 1fr;
|
|
961
|
+
grid-template-rows: auto;
|
|
962
|
+
grid-gap: 50px;
|
|
976
963
|
}
|
|
977
964
|
|
|
978
965
|
/* This *WILL* work in IE */
|
|
979
966
|
@media (max-width: 600px) {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
967
|
+
.grid {
|
|
968
|
+
grid-template-columns: 1fr 1fr;
|
|
969
|
+
grid-template-rows: auto;
|
|
970
|
+
grid-gap: 20px;
|
|
971
|
+
}
|
|
985
972
|
}
|
|
986
973
|
|
|
987
974
|
/* This *WILL* work in IE */
|
|
988
975
|
.grid.small-gap {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
976
|
+
grid-template-columns: 1fr 1fr;
|
|
977
|
+
grid-template-rows: auto;
|
|
978
|
+
grid-gap: 20px;
|
|
992
979
|
}
|
|
993
980
|
```
|
|
994
981
|
|
|
@@ -1030,6 +1017,13 @@ Properties:
|
|
|
1030
1017
|
JS API is also available:
|
|
1031
1018
|
|
|
1032
1019
|
```js
|
|
1033
|
-
|
|
1034
|
-
console.log(info);
|
|
1020
|
+
console.log(autoprefixer().info())
|
|
1035
1021
|
```
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
## Security Contact
|
|
1025
|
+
|
|
1026
|
+
To report a security vulnerability, please use the [Tidelift security contact].
|
|
1027
|
+
Tidelift will coordinate the fix and disclosure.
|
|
1028
|
+
|
|
1029
|
+
[Tidelift security contact]: https://tidelift.com/security
|