1 | # Autoprefixer [![Cult Of Martians][cult-img]][cult]
|
---|
2 |
|
---|
3 | <img align="right" width="94" height="71"
|
---|
4 | src="http://postcss.github.io/autoprefixer/logo.svg"
|
---|
5 | title="Autoprefixer logo by Anton Lovchikov">
|
---|
6 |
|
---|
7 | [PostCSS] plugin to parse CSS and add vendor prefixes to CSS rules using values
|
---|
8 | from [Can I Use]. It is [recommended] by Google and used in Twitter and Alibaba.
|
---|
9 |
|
---|
10 | Write your CSS rules without vendor prefixes (in fact, forget about them
|
---|
11 | entirely):
|
---|
12 |
|
---|
13 | ```css
|
---|
14 | ::placeholder {
|
---|
15 | color: gray;
|
---|
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 | }
|
---|
26 | ```
|
---|
27 |
|
---|
28 | Autoprefixer will use the data based on current browser popularity and property
|
---|
29 | support to apply prefixes for you. You can try the [interactive demo]
|
---|
30 | of Autoprefixer.
|
---|
31 |
|
---|
32 | ```css
|
---|
33 | ::-moz-placeholder {
|
---|
34 | color: gray;
|
---|
35 | }
|
---|
36 | :-ms-input-placeholder {
|
---|
37 | color: gray;
|
---|
38 | }
|
---|
39 | ::-ms-input-placeholder {
|
---|
40 | color: gray;
|
---|
41 | }
|
---|
42 | ::placeholder {
|
---|
43 | color: gray;
|
---|
44 | }
|
---|
45 |
|
---|
46 | .image {
|
---|
47 | background-image: url(image@1x.png);
|
---|
48 | }
|
---|
49 | @media (-webkit-min-device-pixel-ratio: 2),
|
---|
50 | (min-resolution: 2dppx) {
|
---|
51 | .image {
|
---|
52 | background-image: url(image@2x.png);
|
---|
53 | }
|
---|
54 | }
|
---|
55 | ```
|
---|
56 |
|
---|
57 | Twitter account for news and releases: [@autoprefixer].
|
---|
58 |
|
---|
59 | <a href="https://evilmartians.com/?utm_source=autoprefixer">
|
---|
60 | <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
|
---|
61 | </a>
|
---|
62 |
|
---|
63 | [interactive demo]: https://autoprefixer.github.io/
|
---|
64 | [@autoprefixer]: https://twitter.com/autoprefixer
|
---|
65 | [recommended]: https://developers.google.com/web/tools/setup/setup-buildtools#dont_trip_up_with_vendor_prefixes
|
---|
66 | [Can I Use]: https://caniuse.com/
|
---|
67 | [cult-img]: http://cultofmartians.com/assets/badges/badge.svg
|
---|
68 | [PostCSS]: https://github.com/postcss/postcss
|
---|
69 | [cult]: http://cultofmartians.com/tasks/autoprefixer-grid.html
|
---|
70 |
|
---|
71 |
|
---|
72 | ## Docs
|
---|
73 | Read **[full docs](https://github.com/postcss/autoprefixer#readme)** on GitHub.
|
---|