Responsive CSS border radius with the Fab Four technique
Blog post from LogRocket
In recent years, browser support for CSS features has significantly improved, allowing for easier execution of tasks like vertically centering divs, although some features like container-queries remain limited to certain browsers. The article delves into the "Fab Four" technique, a CSS approach employing functions such as min, max, calc, and clamp to apply styling based on the container's dimensions rather than the screen width. This method is particularly useful for conditions where a container's width dictates style changes, like altering the border-radius of elements when their container is below a specific width breakpoint. The technique, popularized by Facebook engineer Frank Yan, can be complex and is sometimes suggested not to be manually coded due to its intricacy. The piece also explores practical implementations using CSS variables, SASS mixins, and CSS-in-JS libraries, while highlighting the limitations of traditional media queries in scenarios with resizable containers. As web technologies advance, features like container-queries are expected to become more widely adopted, but until then, techniques like the Fab Four offer a workaround for specific styling needs.