Search code examples
cssfrontendcss-calc

Css: min contains 2 expressions with different units


height: min(483px, 100vw * 0.82)

Error: px and vw are not comoatible units

How to get the min between the 2 values above ? Or transform the vw to px ?


Solution

  • Wrapping with calc solved the problem:

    height: calc(min(483px, 100vw * 0.82));