From the course: CSS Layouts: From Float to Flexbox and Grid
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Exercise: Build a layout with Grid - CSS Tutorial
From the course: CSS Layouts: From Float to Flexbox and Grid
Exercise: Build a layout with Grid
- [Speaker] In our previous codepen exercise, we got some practice building a basic grid layout. In this exercise, we're going to do the same, but take it a step further and create a 12-column grid system to lay out the page components. Let's update the CSS file path to grid CSS and open the file. (clicks loudly) The first thing we'll do is set up the dimensions. In the container block, add display grid to define this div as the grid container. (clicks loudly) Then we'll use grid template columns with the repeat function. (typing loudly) Inside the parentheses, let's set the first value to 12 for 12 columns, followed by a comma. For the size value, we'll use the minmax function. The space between the comma and the minmax isn't required, but I like to add it for readability. For the minmax value, we'll set the first value, which is the minimum to zero. When there's no content, an empty column will not be displayed.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
- Grid vs. Flexbox1m 40s
- Grid, grid systems, and CSS Grid2m 48s
- (Locked) Create a basic Grid layout4m 58s
- (Locked) Columns, rows, and gutters with Grid3m 44s
- (Locked) Positioning with Grid3m 41s
- (Locked) Exercise: Build a layout with Grid4m 28s
- (Locked) Exercise: Create a sticky footer with Grid3m 39s
-
-