CSS infinity keyword lets developers ditch arbitrary values like 9999px
Web developer Adam Argyle published a post on nerdy.dev on July 25, 2026, detailing practical uses of the CSS infinity keyword in modern stylesheets. Rather than writing arbitrary large numbers like 9999px for pill-shaped borders, developers can use calc(infinity * 1px) to let the browser resolve the true maximum value. The keyword also enables tricks such as freezing animations, setting unlimited z-index stacking, and creating viewport-filling box shadows without manual measurement. One of the most powerful applications is encoding a boolean step function inside clamp(), allowing a border-radius to switch between two values based on container width — no JavaScript or media queries needed. Argyle advises checking browser compatibility before shipping newer primitives like sibling-count() alongside these calc-based patterns.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in