CSS Infinity: A Curious Journey Through Browser Interpretations

This article explores the quirky behavior of the `infinity` keyword in CSS calculation functions. By applying `infinity` to properties like `text-indent`, `word-spacing`, and `letter-spacing`, the author discovers inconsistencies in how different browsers handle infinite values, although the visual results consistently lead to horizontal overflow. More intriguingly, when used with `z-index`, the computed value of `infinity` is capped at the maximum integer value across browsers, resulting in unexpected stacking order. Finally, the author experiments with `infinity` for animation duration, finding that it translates to extremely long times, even causing Safari to render the page unresponsive. In short, the experiment reveals the different strategies browsers employ in handling infinite values in CSS and some surprising side effects.
Read more