Global Side Menu Width
Placeholder

CSS Challenge

You are here:

Learning Intention:

By the end of this lesson, students will be able to recreate a complex web design using only CSS by effectively applying layout, colours and typography principles.

Success Criteria:

Students can:

  • Identify and implement appropriate CSS properties for layout structures such as grids or flexbox.
  • Apply correct colour schemes and typographic styles using CSS (or imported CSS) to match the given design.
  • Modify CSS rules to adjust spacing, alignment, and font styling for accuracy in design replication.

Let's Get Started with CSS Grid

CSS Grid is a powerful layout system designed for creating two-dimensional layouts on the web. It allows you to define both rows and columns, making it ideal for designing complex layouts where elements need to be arranged in a grid format.

The main components are:

  • Grid container: The parent element that defines the grid structure.
  • Grid items: The child elements that are placed within the grid.

Key features include:

  • Grid template rows and columns: Define the size and number of rows and columns.
  • Grid gap: Add spacing between rows and columns.
  • Grid areas: Assign grid items to specific areas, creating a clear layout structure.
  • Auto-placement: Automatically positions items in available grid cells.

CSS Grid is especially useful when creating layouts like photo galleries, dashboards, or any design where you need precise control over both the horizontal and vertical positioning of elements.

Click on the Tabs below to find out more about some specific parameters for the CSS Grid. Otherwise you can also check out the W3Schools Guide on the CSS Grid here: CSS Grid Layout

Now for some hands on:

Let’s quickly play a game that requires you to modify elements using CSS.

You will need to register to the site, but that’s so that we can practice with a number of games.

The game can be found here: Grid Garden (by CodePip)

The Basic Grid Activity

Download the two files required for the from the Unit 1 GitHub Repository. You will need CSSChallenge1.html and CSSChallenge1.CSS. There is also a completed file available if you require it for review.

Initially, the HTML file will be styled to look like it does below. There are 5 sections, each with a different colour set as their background (with a foreground colour set to the same.

Once you have both files, modify only the CSS file with some styling of the CSS Grid, the final output needs to look like the image below.

Let's Keep Going With Flexbox

CSS Flexbox is a layout model that allows you to create flexible and responsive web layouts. It organizes elements within a container, making it easier to align, distribute, and size them, even when their sizes are unknown or dynamic.

The Flexbox model consists of a flex container and flex items. The container can expand or shrink its items to fit the available space, whether on mobile or desktop screens.

Key features include:

  • Flex direction: You can arrange items in rows or columns.
  • Justify content: Align items horizontally (e.g., left, right, center).
  • Align items: Align items vertically.
  • Flex-grow and flex-shrink: Control how items grow or shrink to fill the container.

Flexbox is great for building layouts where you want items to adjust their size and position dynamically, such as navigation menus, card layouts, and more.

Click on the Tabs below to find out more about some specific parameters for the CSS Flexbox. Otherwise you can also check out the W3Schools Guide on the CSS Flexbox here: CSS Flexbox.

Now for some hands on:

Let’s quickly play a game that requires you to modify elements using CSS.

You will need to register to the site, but that’s so that we can practice with a number of games.

The game can be found here: Flexbox Froggy (by CodePip)

The Basic Flexbox Activity

Alright, so very similiar to the activity you completed above, you will need to make the initial files that can be found in the Unit 1 GitHub Repository look like the final output below. You will need the following files: CSSChallenge2.html and CSSChallenge2.css.

Initial styling:

Expected final styling: