CSS Infinity Use Cases

Chris Coyier Chris Coyier on

It’s kinda cool there is Infinity in CSS. You just always need to use it within a calc(), like border-radius: calc(infinity * 1px);. Adam has lots of ideas in that post, and I remember Will was messing with similar ideas a few years ago.

I’d say just use it when you’re trying to use an absolutely huge number like 99999 or whatever, as it expresses what you mean more clearly. But it’s not always quite right. I was just watching Kevin’s new favorite trick video where he uses 1e5 as a big value in a clamp() and infinity doesn’t work there, calc() or not.

Wanna learn modern CSS layout?

Leave a Reply

Your email address will not be published. Required fields are marked *

$966,000

Master.dev donates to open source projects through thanks.dev and Open Collective, as well as donates to non-profits like The Last Mile, Annie Canons, and Vets Who Code.