From the course: CSS: Combining Grid and Flexbox

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Choosing the right solution for the job

Choosing the right solution for the job - CSS Tutorial

From the course: CSS: Combining Grid and Flexbox

Choosing the right solution for the job

- [Instructor] CSS Grid and Flexbox's coexistence allows us to do magical things. They should be used in conjunction with each other. We can use Flex for what it's supposed to be, which is flexing content within a box to either line up horizontally or vertically or break nicely. And we can use Grid for the overall layout. Let's look at a few areas and talk about what may impact our design to use, Flex or Grid? In this first example, things look pretty straight forward. We have five pictures, some text, and a header. If we overlay a grid on top of our layout, you can start to see the structure of what we'll need to do. Now with the pictures, the answer is easy. They overlap. The only solution between Grid and Flex is to use Grid. Grid allows us to create overlapping elements while Flex will not. Here, I'm using a 10-column grid, so I can overlap the five images. I'll be showing you how to build this in an upcoming…

Contents