The CSS Grid Layout specification is one of a few new specifications that are redefining how we approach layout for the web. Alongside Flexbox and the Box Alignment Module it will become part of a modern layout system for websites and web applications.
This site is growing collection of examples, with the aim of helping people understand how Grid Layout works.
To view any of the examples in this site you need to enable CSS Grid Layout in your browser, or use a "Nightly" version of a browser that has Grid available. Read more about browser support for Grid.
These examples have been created by Rachel Andrew. I have been writing and speaking about the specification over the last few years.
If you spot any problems, have an enhancement suggestion or would like to see a certain aspect of the module explained then feel free to either submit a pull request or just drop me a line on firstname.lastname@example.org. I’m also on Twitter as rachelandrew.
If you use these examples in your blog post, presentation or article then I’d appreciate a link back to this site.
The CSS Working Group have posted asking for community feedback on the CSS Grid Layout module before the Level 1 specification goes to Candidate Recommendation later this year.
There is an excellent blog post from Manuel Rego Casasnovas, who works at Igalia and is involved in implementing Grid in Chrome and Blink. Read how the spec has evolved over 2014.
A second post from Manuel describes the current browser implementation status.
In Box Alignment and Grid Layout II Javier Fernández writes about the box alignment implementation. This work meant I needed to redo many of the screenshots in my examples as
stretch is now implemented.
My latest book is Get Ready for CSS Grid Layout published by A Book Apart.
The simplest example. Create a three column grid. Grid Layout will auto place items one in each cell.
Using grid-template-areas to lay out our elements on the grid.
We can layer positioned items on our grids.
Using auto-flow to fill grid columns.