Computer Science Grade 7 20 min

Responsive Design

Responsive Design

Tutorial Preview

1

Introduction & Learning Objectives

Learning Objectives Define Responsive Design and explain why it's important. Identify the difference between a fixed and a fluid layout. Explain the purpose of a CSS Media Query. Write a simple media query to change a website's style based on screen size. Use percentage-based widths to create a basic fluid element. Describe the 'Mobile-First' design strategy. Ever noticed how a website looks perfect on a big computer screen, but then magically rearranges itself to fit on your phone? 📱➡️💻 Let's learn that magic! In this lesson, you'll discover Responsive Design, the technique web developers use to make websites look great on any device, from giant TVs to tiny smartwatches. We'll learn how to use special CSS rules that act like 'if&#0...
2

Key Concepts & Vocabulary

TermDefinitionExample Responsive DesignAn approach to web design that makes web pages render well on a variety of devices and window or screen sizes.A news website shows articles in three columns on a wide desktop screen, but stacks them into a single column on a narrow phone screen. ViewportThe user's visible area of a web page. It's the 'window' through which you see the website, and it changes depending on the device.The viewport on a laptop is wide and short, while the viewport on a smartphone held vertically is narrow and tall. Fluid Grid / LayoutA layout system that uses relative units, like percentages, for widths instead of fixed units like pixels. This allows the layout to stretch and shrink with the screen size.Setting a container's width to `width: 80%;...
3

Core Syntax & Patterns

The Media Query Rule @media (condition) { /* CSS rules go here */ } This is the fundamental rule for responsive design. The `condition` checks a feature of the device, like its width. If the condition is true, the CSS rules inside the curly braces `{}` are applied. It works just like an `if` statement in programming. The Fluid Width Pattern selector { width: percentage%; } Instead of using fixed pixels (e.g., `width: 800px;`), use percentages. This makes elements flexible, so they grow and shrink relative to the size of their container (often the screen itself).

4 more steps in this tutorial

Sign up free to access the complete tutorial with worked examples and practice.

Sign Up Free to Continue

Sample Practice Questions

Challenging
A website has a complex navigation bar with 10 links that fits perfectly on a desktop. Following the 'Mobile-First' principle and good responsive design, what is the BEST approach for this navigation on a small mobile screen?
A.Hide the navigation bar completely on mobile.
B.Shrink the text of all 10 links until they fit in one row.
C.Replace the list of links with a single 'hamburger' menu icon that reveals the links when tapped.
D.Make the user scroll horizontally to see all 10 links.
Challenging
A designer wants a layout with 3 columns on desktops, 2 columns on tablets, and 1 column on phones. What is the minimum number of breakpoints needed to create this responsive layout?
A.1
B.2
C.3
D.4
Challenging
Given this CSS, what will a paragraph's font size and color be on a screen that is 950px wide? `p { font-size: 16px; color: black; }` `@media (min-width: 700px) { p { font-size: 18px; } }` `@media (min-width: 1000px) { p { font-size: 20px; color: blue; } }`
A.16px and black
B.20px and blue
C.18px and black
D.18px and blue

Want to practice and check your answers?

Sign up to access all questions with instant feedback, explanations, and progress tracking.

Start Practicing Free

More from Web Development

Ready to find your learning gaps?

Take a free diagnostic test and get a personalized learning plan in minutes.