WDD 130: Web Fundamentals

W04 Learning Activities: Using CSS Layouts

Overview

Mastering CSS Flex and Grid can be challenging. This activity highlights some of the most relevant layouts and the principles behind them.

Prepare

When do I use CSS Flex versus CSS Grid?

Depending on the desired layout, you can often make either method work. You can even use them together, such as using flex to align items within a grid item.

Choose Flex
Choose Grid

Common Layout Methods

Activity Instructions

  1. Navigate to this CodePen ☼ CSS Layout Exercises
  2. Complete the three exercises to the best of your ability. The following images are screenshots of the solutions:
    Layout Exercise 1 Output
    Layout Exercise 2 Output
    Layout Exercise 3 Output
    Check Your Understanding

    Example: CodePen ☼ Layout Exercises - Solution