Get on this CSS-GRID level
I like CSS frameworks a lot! Use them all the time. Very few complaints.
I’m also one of those front end developers that had no strong opinions on whichever framework I was using. Mostly.
I like bells and whistles in my CSS frameworks, and I don’t like to spend a lot of time configuring things. For the last year and change I’ve been enjoying Foundation quite a bit (Love you, rem-calc() and @breakpoint!), but before that I was a die hard Bootstrap enthusiast. Although I’ve heard the complaints that sometimes frameworks can be heavy or cumbersome, offer too much or too little, I personally appreciate them as it saved me a lot of unnecessary prework.
I probably would have gone on using CSS frameworks without a second thought until I saw that Foundation had upgraded yet again from version 6.3 to 6.4. I remember being involved with projects going from Foundation 5 to 6 being somewhat of a headache to get used to, so I could only imagine what Exedrin worthy moments that this versioning might entail as we were going from a grid on one plane (the X axis) to two plains (both X and Y).
Coincidentally, one of my coworkers introduced me to CSS grid as I was wrapping my head around a two dimensional grid system possibility and my mind was blown. I actually was unaware that the CSS grid was not a new idea put out by the people at Zurb, but rather a new feature that’s been en vogue this year (its currently a W3C Candidate Recommendation). But what is CSS grid all about?
In its simplest form, CSS grid is all about containers, and the display properties set on that container. A container dictates the grid display property, plus how many columns and rows within and gutters. Essentially, as front end developers we are free to come up with grids that suit our needs, and then in those grids place the items where they would be most useful.
But it gets even more interesting than that. Because we are free to create grids that fit our needs, within each grid cell we have free reign to put any element that we would like in there... including another grid. So, for example, if we wanted to have a widget on a larger grid that flexibly changed at different breakpoints, a nested CSS grid would handle that with ease.
Mind blowing, is it not?
To test it out, I made a test project (professing my preference for cats). I first got familiar with creating grids, rows and columns. Then I had some fun seeing these elements in action and tried adding in a nested grid that behaved differently at different breakpoints. You can check out the repository here, which has all of my notes added for future reference.
I found learning the concepts of CSS grid to be incredibly simple (if you’re a seasoned pro with any of the popular CSS frameworks out there), but the caveats really lied in the flexibility. For example, as I decided to use percentages for flexible columns, but also used fixed widths for images- which looked bizarre at certain breakpoints. Also, I stumbled a bit on vertical alignment on items of various heights, but once I remembered that I could define where in a grid or nested grid I wanted an item to be placed, it got much easier to get the alignment that I wanted.
Overall, learning to use CSS grid wasn’t hard to pick up, and offers greater control over the visual state of your application with less future upgrade headaches. CSS grid is also widely supported (save for some versions of internet explorer and Opera, which can be accommodated with a polyfill).
If you have the time and interest, Id suggest reading the MDN documentation as a starting point and try out a test project for yourself. In an afternoon or less, you too could be creating simple yet sophisticated layouts with a minimum of markup.
Although I may go back to using pre-established and battle tested frameworks out of habit, after trying out CSS grid, I no longer feel like writing my own grid system is out of the realm of possibility for me. CSS grid is superbly simple and incredibly enjoyable.
So perhaps I am starting to form that strong opinion...













