From the course: CSS Toolkit: Tips and Techniques for Layout and Styling
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Stacking elements using grid - CSS Tutorial
From the course: CSS Toolkit: Tips and Techniques for Layout and Styling
Stacking elements using grid
- [Instructor] Let's talk about one of the most game-changing features of CSS grid. I'll give you a hin, it's not just about rows and columns. The grid module allows us, for the first time, to lay out content in the depth dimension, literally stacking elements on top of each other in the same grid space to create layouts that were previously impossible without a whole lot of extra markup or hacky things. So here I've got an example in action. I've got this basic figure element, and it contains an image and a figcaption. Inside of this figcaption, we've got a blockquote, a citation, and a paragraph. That's it. There's no extra divs, nothing fancy going on here. But visually, we've got an intricate, layered card with background elements, text overlays, and stylized accents, all precisely positioned and stacked using grid. Let's look at what's going on, and to make that a little easier to see, let me turn on the grid overlay for our card. So it starts by applying a grid to this figure…
Contents
-
-
-
-
-
-
-
(Locked)
Should you use grid, flex, or flow?2m 45s
-
(Locked)
Adding gaps and gutters to grid and flex2m 24s
-
(Locked)
Pseudo-elements are true grid and flex items2m 40s
-
(Locked)
Stacking elements using grid3m 19s
-
(Locked)
Nesting grid items with subgrid5m 6s
-
(Locked)
Adding fixed and sticky elements3m 51s
-
(Locked)
-