WDD 130: Web Fundamentals

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: WDD Layout Exercises
  2. Log into your CodePen account. If you do not have an account, you can create one for free. An account allows you to save pens to your own account.

    Accounts at CodePen are free. You can use your Google, GitHub, Facebook, or an email account of your choice to sign up.

    It is highly recommended that you obtain an account to manage your own snippets of work and fork, i.e., copy, useful pens that you discover. You are not required to get an account as you can view and edit the code in the pen for free, however, your changes will not be saved for future use and reference.

  3. 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

    Solution Example: Layout Exercises - Solution - CodePen