HTML CSS
Advanced
60 mins
Teacher/Student led
+155 XP
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Introduction to Responsive Design

Learn the principles of responsive web design and create a webpage that adapts to different screen sizes.

Teacher Class Feed

Load previous activity

    1 - Understanding Responsive Design

    Responsive design is the approach of designing webpages that can adapt to different screen sizes and devices, ensuring a consistent user experience. This is important because users access websites on various devices, such as smartphones, tablets, and desktop computers.

    In this lesson, you will learn the basics of responsive design and create a webpage that adapts to different screen sizes.


    2 - Setting Up the HTML Structure

    First, let's set up a basic HTML structure for our webpage. Create a new HTML file and add the following code:

    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Responsive Design</title>
    </head>
    <body>
      <h1>Welcome to My Responsive Webpage</h1>
      <p>This is a paragraph of text.</p>
    </body>
    </html>

    3 - Adding CSS

    In this step, we will add some CSS to style our webpage. We will set the font for the entire body, add a background color and text color to the heading, and add padding to the paragraph. Add the following CSS code:

    body {
      font-family: Arial, sans-serif;
      margin: 0;
      padding: 0;
    }
    
    h1 {
      background-color: #f1c40f;
      color: #ffffff;
      padding: 20px;
    }
    
    p {
      padding: 20px;
    }

    4 - Creating a Container

    In this step, we will create a container to hold our webpage content. This container will help us control the layout of our content on different screen sizes. Update your code so that <h1> and <p> tags are inside the new <div> tag.

    <div class="container">
      <h1>Welcome to My Responsive Webpage</h1>
      <p>This is a paragraph of text.</p>
    </div>
    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2026. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more