Layouts templates
Page skeletons and the grid and flexbox recipes behind them.
4 templates
The layouts people rebuild on every project, written with modern CSS rather than the float and clearfix workarounds that are still all over the web. Most need no media queries at all.
Holy grail layout
Header, footer, two sidebars and a main column — in nine lines of grid.
HTMLCSSCentering recipes
Six ways to centre something, and which one to use when.
HTMLCSSResponsive grid without media queries
Four grid recipes that reflow on their own, using auto-fit, minmax and container queries.
HTMLCSSSticky footer
A footer that sits at the bottom of the viewport on short pages and below the content on long ones.
HTMLCSSJavaScriptMost of these used to be hard
The holy grail layout got its nickname because building it with floats took a wrapper div, negative margins and a clearfix. It is now nine lines of grid, and you can read the shape of the page directly out of the CSS. The sticky footer needed a hard-coded footer height that broke whenever anyone edited the footer; it is now three lines.
The templates here are written with current CSS rather than the workarounds that are still all over the web — which matters, because those workarounds are what most search results will hand you.
Stop writing breakpoints
Media queries respond to the viewport. Most layout problems are actually about the space a component has, which is not the same thing — a card in a sidebar and the same card at full width both need to reflow, and the viewport width tells you nothing about either.
repeat(auto-fit, minmax(240px, 1fr)) fits as many columns as will go and stretches them to
fill the row. Six items, four items, one item: it adapts at every width with no breakpoints to maintain.
Container queries take this further, responding to the component's own width, and support is now good
across current browsers.
Other categories
All of them are free
No attribution, no licence to read. Copy what you need.