Lesson 5.1 β What is Responsive Design?
π Creating Websites That Work on Mobile, Tablet, Laptop, and Desktop Screens
π― Learning Objectives
After completing this lesson, students will be able to:
β Understand Responsive Design
β Identify Different Screen Sizes
β Understand Why Responsive Websites Are Important
β Learn Mobile-Friendly Design Concepts
β Create Better User Experiences
β Prepare for Media Queries
β Build Modern Websites
π Introduction
Imagine you create a beautiful website on your laptop.
On your laptop it looks like:
----------------------------------
WELCOME TO MY WEBSITE
Home About Contact
----------------------------------
Looks perfect.
Now open the same website on a mobile phone.
WELCOME TO MY WEBSITE
Home About Contact
Everything may become:
β Too small
β Difficult to read
β Difficult to click
β Poor user experience
This problem is solved using:
π± Responsive Web Design
π€ What is Responsive Design?
Responsive Design means:
A website automatically adjusts
its layout according to screen size.
A responsive website works properly on:
π± Mobile Phones
π± Tablets
π» Laptops
π₯οΈ Desktop Computers
π Simple Definition
Responsive Design is a web design technique that makes websites look good on every device.
π― Example
Non-Responsive Website
Desktop:
HTML CSS JS React
Mobile:
HTML CSS JS React
Everything becomes squeezed.
Responsive Website
Desktop:
HTML CSS JS React
Mobile:
HTML
CSS
JS
React
Automatically adjusted.
π Why Responsive Design is Important?
Today most internet users use:
π± Smartphones
instead of:
π₯οΈ Desktop Computers
Statistics show:
More than half of website visitors use mobile devices.
If your website is not responsive:
β Visitors leave quickly
β Poor user experience
β Lower search ranking
β Difficult navigation
Responsive websites:
β Look professional
β Increase visitors
β Improve usability
β Work on all devices
π― Types of Devices
π± Mobile Phones
Screen Width:
320px β 767px
Examples:
- Android Phones
- iPhone
π± Tablets
Screen Width:
768px β 1023px
Examples:
- iPad
- Android Tablets
π» Laptops
Screen Width:
1024px β 1439px
π₯οΈ Desktop Computers
Screen Width:
1440px and above
π Responsive Website Example
Desktop View:
--------------------------------
LOGO
HOME ABOUT CONTACT
--------------------------------
SERVICE 1 | SERVICE 2 | SERVICE 3
--------------------------------
Mobile View:
LOGO
HOME
ABOUT
CONTACT
SERVICE 1
SERVICE 2
SERVICE 3
Same website.
Different arrangement.
π― Why Old Websites Fail
Older websites often used:
width:1200px;
Fixed width.
Problem:
Mobile screen:
400px
Website:
1200px
Result:
β Horizontal scrolling
β Broken layout
π Modern Responsive Websites Use
Instead of:
width:1200px;
Use:
width:100%;
Or:
max-width:1200px;
Benefits:
β Flexible Layout
β Better Mobile Experience
π― Responsive Design Principles
Modern websites follow:
Principle 1
Flexible Layouts
Example:
width:100%;
Principle 2
Responsive Images
Example:
img{
width:100%;
}
Images automatically resize.
Principle 3
Responsive Grids
Example:
display:grid;
or
display:flex;
Principle 4
Media Queries
Example:
@media
Used to change design according to screen size.
π Real World Example
YouTube
Desktop:
Video Video Video Video
Mobile:
Video
Video
Video
Amazon
Desktop:
Product Product Product Product
Mobile:
Product
Product
Product
Desktop:
Sidebar Feed Sidebar
Mobile:
Feed
Only important content shown.
π― Responsive vs Non-Responsive
| Feature | Responsive | Non-Responsive |
|---|---|---|
| Mobile Friendly | β | β |
| Tablet Friendly | β | β |
| Better UX | β | β |
| Modern Design | β | β |
| Professional | β | β |
π Basic Responsive Example
HTML
<div class="box">
Responsive Website
</div>
CSS
.box{
width:80%;
margin:auto;
background-color:lightblue;
padding:20px;
}
Why Responsive?
width:80%;
adapts to screen size.
π― Responsive Navigation Example
Desktop:
Home About Contact Services
Mobile:
Home
About
Contact
Services
Automatically adjusted using responsive techniques.
π Responsive Images
Wrong:
img{
width:1000px;
}
Correct:
img{
max-width:100%;
height:auto;
}
Benefits:
β No overflow
β Mobile friendly
π» Complete Practical Program
HTML
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>
Welcome Students
</h1>
<p>
Learning Responsive Design
</p>
</div>
</body>
</html>
CSS
π― Exp
body{
font-family:Arial;
}
.container{
width:80%;
margin:auto;
padding:20px;
background-color:lightyellow;
border:2px solid orange;
}
ected Output
Responsive container:
β Adapts to screen size
β Centers automatically
β Mobile friendly
π« Real World Examples
Responsive Design is used in:
β Google
β YouTube
β Amazon
β Facebook
β Instagram
β LinkedIn
β Educational Websites
β οΈ Common Beginner Mistakes
Mistake 1
Using Fixed Width
Wrong:
width:1200px;
Better:
width:100%;
Mistake 2
Large Images
Wrong:
img{
width:2000px;
}
Better:
img{
max-width:100%;
}
Mistake 3
Ignoring Mobile Devices
Always test on:
π± Mobile
π» Laptop
π₯οΈ Desktop
π Best Practices
β Use percentages.
β Use max-width.
β Use responsive images.
β Use Flexbox and Grid.
β Test on different screen sizes.
π Mini Project β Responsive Information Card
Create a card containing:
Student Name
College Name
Branch
Apply:
width:80%;
max-width:500px;
margin:auto;
π Practical Activity
Create a responsive container.
Requirements:
β Width = 80%
β Max Width = 600px
β Center Alignment
β Background Color
Observe behavior when browser size changes.
π Assignment
Assignment 5.1
- What is Responsive Design?
- Why is Responsive Design important?
- Which devices use responsive websites?
- What is the difference between responsive and non-responsive websites?
- Why should images be responsive?
- Create a responsive container.
- Explain the importance of mobile-friendly websites.
π§ Quiz
Q1. What is Responsive Design?
A. Fixed Website
B. Mobile App
C. Website adapting to screen size
D. Database
β Answer: C
Q2. Which unit is more responsive?
A. px
B. %
C. cm
D. mm
β Answer: B
Q3. Which property helps responsive images?
A. width:2000px
B. max-width:100%
C. height:500px
D. size:auto
β Answer: B
Q4. Which devices require responsive design?
A. Mobile
B. Tablet
C. Desktop
D. All of These
β Answer: D
Q5. Responsive websites provide?
A. Better User Experience
B. Poor Layout
C. Broken Design
D. None
β Answer: A
π Lesson Summary
β Responsive Design allows websites to adapt to different screen sizes.
β Modern websites must support mobile, tablet, laptop, and desktop devices.
β Responsive layouts improve user experience.
β Percentages and max-width help create flexible designs.
β Responsive design is a fundamental skill for modern web developers.