Book Image

Mastering CSS Grid

By : Pascal Thormeier
4 (2)
Book Image

Mastering CSS Grid

4 (2)
By: Pascal Thormeier

Overview of this book

CSS Grid has revolutionized web design by filling a long-existing gap in creating real, dynamic grids on the web. This book will help you grasp these CSS Grid concepts in a step-by-step way, empowering you with the knowledge and skills needed to design beautiful and responsive grid-based layouts for your web projects. This book provides a comprehensive coverage of CSS Grid by taking you through both fundamental and advanced concepts with practical exercises. You'll learn how to create responsive layouts and discover best practices for incorporating grids into any design. As you advance, you'll explore the dynamic interplay between CSS Grid and flexbox, culminating in the development of a usable responsive web project as a reference for further improvement. You'll also see how frameworks utilize CSS Grid to construct reusable components and learn to rebuild and polyfill CSS Grid for browsers that don't fully support it yet. The concluding chapters include a quick reference and cheat sheet, making this book an indispensable resource for frontend developers of all skill levels. By the end of this book, you'll have thoroughly explored all aspects of CSS Grid and gained expert-level proficiency, enabling you to craft beautiful and functional layouts for web projects of any size.
Table of Contents (16 chapters)
1
Part 1–Working with CSS Grid
5
Part 2 – Understanding the CSS Grid Periphery
9
Part 3 – Exploring the Wider Ecosystem
12
Part 4 – A Quick Reference

Learning how Cutestrap implements grids

Cutestrap was developed roughly between 2016 and 2019. The original developer, Tyler Childs, stated that he primarily developed the framework for himself before making it open source. Somehow, it got traction on Hacker News, and people seemed to love it. With 2.7 kb minified and gzipped, it is smaller than Pure.css and offers even fewer features. However, it is one of the few frameworks to implement a grid system using CSS Grid.

We can see the landing page of the Cutestrap website in the following screenshot:

Figure 8.15 – The Cutestrap landing page

Figure 8.15 – The Cutestrap landing page

The grid system works with three CSS classes and a single custom property, which can be set with inline styles on the grid container. To define a grid, we use the grid class. It automatically applies grid-template-columns: repeat(var(--columns), minmax(0, 1fr));, the --columns custom property defaults to auto-fit, meaning that all elements are spaced out equally...