CSS Subgrid News and demos

A couple of weeks ago I spoke at Frontend NE in Newcastle, a big part of my talk was explaining what the CSS Grid Subgrid feature from Grid Level 2 would contain. With no implementation to work with, I had mocked up a bunch of demos using DevTools for …


This content originally appeared on this is rachelandrew.co.uk and was authored by this is rachelandrew.co.uk

A couple of weeks ago I spoke at Frontend NE in Newcastle, a big part of my talk was explaining what the CSS Grid Subgrid feature from Grid Level 2 would contain. With no implementation to work with, I had mocked up a bunch of demos using DevTools for that talk.

En route to San Francisco to Smashing Conf, where I was running a CSS Layout workshop, I was given access to a Try build of Firefox Nightly, which has an early implementation of the feature. This does mean I need to redo some slides for my talks in May so they can use real screenshots, but I’ll take that for actually getting my hands of the feature and being able to try the demos for real!

I posted a couple of screenshots on Twitter, and I will be publishing all of my examples over at Grid by Example once the feature is behind a flag in regular Nightly. However for everyone who had better things to be doing than looking at Twitter over the weekend here are a few screenshots. These include links to my CodePen examples so you can see the code for the subgrid elements. I’ve highlighted the grid and subgrid in Firefox DevTools to help you see what you are looking at.

Subgrid for columns and rows

Columns and rows

In this case the subgrid is on columns and rows of the parent. This means that there is no implicit grid in the subgridded area, as both dimensions are tied to the available tracks on the parent grid.

CodePen example for subgrid columns and rows.

Subgrid for columns only

Columns

In this case I have used a subgrid for columns. This means I can use implicit grid tracks to add as many rows as needed for the items. The rows use their own sizing, just as a nested grid would without subgrid.

CodePen example for subgrid columns

Subgrid for rows only

Rows

In this case I have made the rows a subgrid, and defined columns as normal in fr units. As you can see the column tracks do not line up with the parent as they are using their own grid definition.

CodePen example for subgrid rows

I’m so excited to be seeing this in progress, and also to be able to teach it in my workshops and talks. For more background on subgrid, here are some links.


This content originally appeared on this is rachelandrew.co.uk and was authored by this is rachelandrew.co.uk


Print Share Comment Cite Upload Translate Updates
APA

this is rachelandrew.co.uk | Sciencx (2019-04-16T18:48:00+00:00) CSS Subgrid News and demos. Retrieved from https://www.scien.cx/2019/04/16/css-subgrid-news-and-demos/

MLA
" » CSS Subgrid News and demos." this is rachelandrew.co.uk | Sciencx - Tuesday April 16, 2019, https://www.scien.cx/2019/04/16/css-subgrid-news-and-demos/
HARVARD
this is rachelandrew.co.uk | Sciencx Tuesday April 16, 2019 » CSS Subgrid News and demos., viewed ,<https://www.scien.cx/2019/04/16/css-subgrid-news-and-demos/>
VANCOUVER
this is rachelandrew.co.uk | Sciencx - » CSS Subgrid News and demos. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2019/04/16/css-subgrid-news-and-demos/
CHICAGO
" » CSS Subgrid News and demos." this is rachelandrew.co.uk | Sciencx - Accessed . https://www.scien.cx/2019/04/16/css-subgrid-news-and-demos/
IEEE
" » CSS Subgrid News and demos." this is rachelandrew.co.uk | Sciencx [Online]. Available: https://www.scien.cx/2019/04/16/css-subgrid-news-and-demos/. [Accessed: ]
rf:citation
» CSS Subgrid News and demos | this is rachelandrew.co.uk | Sciencx | https://www.scien.cx/2019/04/16/css-subgrid-news-and-demos/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.