Nested Calc and IE11

Nico JacobsNico Jacobs
1 min read

A while ago, I stumbled upon the weird behavior of IE11 to not accept a CSS calc keyword inside another calc function.

For example, this won't work in IE11:

.foo {
    width: calc(100vw - calc(20% - 10px));
}

while this would work:

.foo {
  width: calc(100vw - (20% - 10px));
}

So I wrote a little PostCSS plugin to fix it. You can find the package and more Information on https://www.npmjs.com/package/postcss-remove-nested-calc

0
Subscribe to my newsletter

Read articles from Nico Jacobs directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nico Jacobs
Nico Jacobs