Get the latest tech news

Modern CSS Layouts: You Might Not Need a Framework for That


It’s easy to get lost in a sea of CSS frameworks and libraries, each promising easier styling and smoother layouts. Brecht De Ruyte demonstrates four CSS utility classes (plus a bonus) using techniques that allow them to be used practically anywhere you need a particular layout — be it Grid or Flexbox — with configurable options.

Brecht De Ruyte demonstrates four CSS utility classes (plus a bonus) using techniques that allow them to be used practically anywhere you need a particular layout — be it Grid or Flexbox — with configurable options. But, in short, elements that are direct children of the.repeating-flex utility class are allowed to grow ( flex-grow: 1) and shrink ( flex-shrink: 1) based on the amount of available space while we inform the browser that the initial size (i.e., flex-basis) of each flex item is equal to some calc()-ulated value. This approach leads to verbose CSS, but sacrificing brevity allows us to automate the layout so it handles practically anything we throw at it without having to update an inline style in the markup.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Framework

Framework

Photo of modern css layouts

modern css layouts

Related news:

News photo

Framework Boosts Its 13-inch Laptop With New CPUs, Lower Prices, and Better Screens

News photo

Framework now lets you upgrade its Laptop 13 with a drop-in 120Hz screen, better webcam, and Core Ultra chip

News photo

Framework Announces Intel Core Ultra Powered Laptop With 2.8k Display