6 ms·
What's the actual use case for "infinity" in CSS?
by calibas 1y ago
What's the actual use case for "infinity" in CSS?
- jdauriemma 1y agoFinal boss of z-index
- Rendello 1y agoWhat about `infinity + 1`? ;)
- elteto 1y agoThat’s the z-index of your nose.
- dole 1y agoz-index = i_love_you;
- mceachen 1y agopow(infinity, infinity) is aliased to no_i_love_you_more in CSS5
- mananaysiempre 1y agoTeX has three levels of infinities (fil, fill and filll).
- PaulDavisThe1st 1y agoCantor has entered the chat.
- azangru 1y agoIsn't the final boss of z-index the top layer?
- burnt-resistor 1y agow buffer cheatcode unlocked.
- adamwathan 1y agoWe use it in Tailwind CSS v4 for pill-shaped borders: .rounded-full { border-radius: calc(1px * infinity); } ...as opposed to what everyone has done historically, which is pick some arbitrary huge value like: .rounded-full { border-radius: 9999px; } No real practical benefit, just satisfyingly more "correct".
- nedt 1y agoNormally 50% is used as each corner is a quarter of the box. Any reason for not simply using that?
- szatkus 1y agoAccording to the spec: These constants are defined mostly to make serialization of infinite/NaN values simpler and more obvious, but can be used to indicate a "largest possible value", since an infinite value gets clamped to the allowed range. It’s rare for this to be reasonable, but when it is, using infinity is clearer in its intent than just putting an enormous number in one’s stylesheet.
- stronglikedan 1y agoSelling pixels at a dollar each to make an Infinity Dollar Website™.