postcss / autoprefixer

Parse CSS and add vendor prefixes to rules by Can I Use
https://twitter.com/autoprefixer
MIT License
21.58k stars 1.25k forks source link

Break inset property to four sides #1433

Closed amir2mi closed 2 years ago

amir2mi commented 2 years ago

I was wondering if Autoprefixer would break the inset property to top bottom left right but it did not. Its browser support is still raw and it is better to convert inset.

It is the use-case for centering elements with absolute position:

Shorthand:

.box{
   position: absolute;
   inset: 0;
   margin: auto;
}

Better be converted to:

.box{
   position: absolute;
   top: 0;
   right: 0;
   bottom: 0;
   left: 0;
   margin: auto;
}
ai commented 2 years ago

Autoprefixer is not for polyfills it is only for prefixes.

For polyfills you should use postcss-preset-env.