From the course: Responsive Layout

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Flexbox and Grid

Flexbox and Grid - HTML Tutorial

From the course: Responsive Layout

Start my 1-month free trial

Flexbox and Grid

- [Instructor] Within the last few years, there have been two new ways to do layout added to CSS, Flexbox and Grid. Although they both can be used to lay out a web page, they each work best under different circumstances. Flexbox allows for you to arrange items inside a container. This makes it ideal for arranging elements along one dimension, either horizontal or vertical. So you generally wouldn't use Flexbox to lay out an entire page unless the layout was very simple. As you can see in this example, the boxes are only aligned in one direction. Even when they're wrapping onto multiple rows, they are still only aligned on each line. Grid lets you arrange items in both rows and columns. This makes it ideal for arranging elements in two dimensions on a web page. Grid is much better than Flexbox for laying out an entire page if you want to have sections of the page in multiple columns, but you can also combine the two. For example, use grid to lay out the main structure of the page and…

Contents