⬅ Back

RESPONSIVE PAGES

People use many different devices to access the internet.

Even one person may use:

So for a developer, one thing is clear: a web page must look good on different screen sizes.

That is exactly why responsive design exists.

1. Why responsive pages are necessary

In the past, many web pages had a fixed width.

For example:

That created problems.

If the screen was:

Old fixed page

Large screen:
+----------------------------------------------+
|              960px page                      |
+----------------------------------------------+

Small screen:
+------------------+
| 960px page ----> |  content does not fit
+------------------+

Modern web pages should work well on:

So modern websites use:

2. Adaptive and responsive design

Adaptive and responsive design are similar, but not the same.

They differ in:

3. Responsive design

A responsive page has several display variations, but the transitions are smooth.

Elements stretch and shrink like rubber.

When the viewport changes:

Responsive idea

Wide screen:
[ sidebar ][ content area                    ]

Medium screen:
[ sidebar ][ content           ]

Small screen:
[ sidebar ]
[ content ]

Important detail: the change between these versions is smooth.

Responsive layout

large  -> medium  -> small
  smooth stretching and shrinking

Main idea:

Responsive = flexible layout with smooth transitions between sizes

4. Adaptive design

An adaptive page also has several versions, but they are more like separate fixed states.

The design changes abruptly at certain breakpoints.

Between those breakpoints, it does not stretch smoothly in the same flexible way.

Adaptive idea

Wide screen:
[ desktop layout ]

At breakpoint:
switch!

Tablet screen:
[ tablet layout ]

At breakpoint:
switch!

Phone screen:
[ mobile layout ]
Adaptive layout

large -----> desktop version
         breakpoint
medium ----> tablet version
         breakpoint
small -----> phone version

Main idea:

Adaptive = separate layout states that switch at exact breakpoints

5. Responsive vs adaptive

Responsive
- flexible width
- smooth resizing
- blocks stretch and shrink

Adaptive
- several fixed versions
- abrupt changes at breakpoints
- less fluid between states

Visual comparison:

Responsive:

[ layout stretches gradually ]

Adaptive:

[ version A ] -> breakpoint -> [ version B ] -> breakpoint -> [ version C ]

Short memory line:

Responsive = fluid
Adaptive   = step-by-step

6. What a breakpoint is

A breakpoint is the viewport size where:

At that point, different CSS rules may apply.

Example idea:

Viewport width

1200px ----------- desktop layout
 900px ----------- tablet layout
 600px ----------- mobile layout
As screen becomes smaller:

[ 3 columns ] -> breakpoint -> [ 2 columns ] -> breakpoint -> [ 1 column ]

Main idea:

Breakpoint = screen width where styles change

7. What the viewport is

The viewport is the visible rectangular area of a web page.

It does not include:

Browser window
+--------------------------------------+
| address bar / browser UI             |
+--------------------------------------+
|                                      |
|            VIEWPORT                  |
|      visible web page area           |
|                                      |
+--------------------------------------+

So the viewport is basically the visible page area inside the browser.

8. Two viewport ideas on mobile

On mobile devices, things get more complicated.

There are two important ideas:

9. Virtual viewport

The virtual viewport is the layout area the browser uses internally.

On many mobile browsers, its default width is often around:

980px

This is much wider than the real phone screen.

Virtual viewport
+---------------------------------------------------+
|                    980px wide                     |
+---------------------------------------------------+

10. Physical viewport

The physical viewport is the real visible screen area of the device.

Example:

phone screen width = 400px
Physical device screen
+----------------------+
|       400px          |
+----------------------+

11. The core mobile problem

By default, a mobile browser may use the virtual viewport width instead of the real device width.

So:

That creates a mismatch.

Real screen:        400px
Virtual viewport:   980px
Browser asks:
"What is the viewport width?"

Wrong default answer:
980px

But real screen is:
400px

This is the core problem.

12. Why that causes layout problems

If the browser thinks the width is 980px, it may apply larger-screen styles.

So on a phone, instead of mobile styles, you may get:

Example:

Phone screen: 400px
Browser layout width: 980px
        down
Browser applies wider-screen styles
        down
Mobile page looks wrong

Visual example:

Expected on phone:
[ one column ]

But browser may show:
[ two columns squeezed ]
Correct mobile version:
[ Header ]
[ Content ]
[ Footer ]

Wrong wider version on phone:
[ Sidebar ][ Content ]

13. Why mobile CSS can fail without viewport setup

Adaptive or responsive CSS often depends on viewport width.

If that width is wrong, the wrong styles can win.

CSS rule for max-width: 800px
should apply on phone

But browser thinks width = 980px
so rule may not apply

Result:

Mobile styles missing
tablet/desktop styles override them

14. The viewport meta tag

To fix this problem, responsive pages must include the viewport meta tag inside <head>.

Code:

<head>
  <!-- Other meta tags -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>The viewport meta tag is important for responsive pages</title>
</head>

This tag tells the browser how to control:

15. What width=device-width means

This part:

width=device-width

means: set the viewport width equal to the physical screen width of the device.

Without viewport meta:
browser width = 980px

With width=device-width:
browser width = real device width

Example:

Phone screen = 400px

Now viewport width = 400px

That makes responsive CSS work correctly.

16. What initial-scale=1.0 means

This part:

initial-scale=1.0

means: use a 1:1 ratio between CSS pixels and device hardware pixels.

Simple idea:

initial-scale=1.0
   down
page starts at normal scale

17. Why the viewport meta tag is essential

Without it:

With it:

Comparison:

Without viewport tag:
phone -> wrong wider layout

With viewport tag:
phone -> correct mobile layout

Visual:

Wrong:
+----------------------+
| [tiny desktop page]  |
+----------------------+

Correct:
+----------------------+
| [proper mobile page] |
+----------------------+

18. Developer tools and responsive mode

Browsers give developers tools for testing responsive layouts.

In Chrome, you can open them and simulate different devices and sizes.

Basic steps:

  1. Open Developer Tools
  2. Enable device toolbar
  3. Resize the viewport or choose a device preset

19. How to open responsive tools in Chrome

Steps:

  1. Open Developer Tools
  1. Click the device toolbar icon
  1. Change viewport width
Developer Tools
   down
Toggle device toolbar
   down
Responsive mode

20. What you can do in responsive mode

At the top of the responsive tools, there are useful controls.

Main controls:

Responsive tools top bar
[ Device ] [ Width x Height ] [ Zoom ] [ Rotate ]

21. Device presets

You can choose real device presets, for example:

Or choose:

Device menu
|- Responsive
|- iPhone
|- iPad
|- Pixel
+- ...

Meaning:

22. Width and height controls

The current viewport width and height can be changed manually.

Width x Height
[ 390 ] x [ 844 ]

This lets you test exact sizes.

Example:

390 x 844 -> phone-like
768 x 1024 -> tablet-like
1440 x 900 -> desktop-like

23. Zoom control

Zoom is useful when the layout is large and you want to see the whole page.

Zoom:
25%   50%   75%   100%

This changes only how you view the page in dev tools. It does not change the actual responsive CSS behavior.

24. Rotate control

The rotate option simulates switching between:

Portrait:
+----------+
|          |
|          |
|          |
+----------+

Landscape:
+------------------+
|                  |
+------------------+

This is very useful because layouts often behave differently when the device rotates.

25. Quick breakpoint testing

Developer tools also provide a quick panel for testing standard breakpoint widths.

This helps you quickly check:

Quick widths:
[ 320 ] [ 375 ] [ 480 ] [ 768 ] [ 1024 ] [ 1280 ]

This makes responsive testing faster.

26. Big responsive workflow diagram

Responsive page building
|
|- understand screen-size differences
|- create flexible layout
|- define breakpoints
|- add viewport meta tag
|- test on different viewport widths
+- adjust layout for mobile / tablet / desktop

27. Real design behavior example

Imagine a page with cards.

Desktop:

+--------+ +--------+ +--------+
| Card 1 | | Card 2 | | Card 3 |
+--------+ +--------+ +--------+

Tablet:

+--------+ +--------+
| Card 1 | | Card 2 |
+--------+ +--------+

+--------+
| Card 3 |
+--------+

Mobile:

+--------+
| Card 1 |
+--------+

+--------+
| Card 2 |
+--------+

+--------+
| Card 3 |
+--------+

This is the kind of adaptation responsive design handles.

28. Common mistakes

Mistake 1: Forgetting the viewport meta tag.

Problem: mobile browser may use virtual width like 980px.

Mistake 2: Thinking responsive and adaptive are exactly the same.

Problem: their behavior between breakpoints is different.

Mistake 3: Testing only on desktop width.

Problem: mobile issues remain hidden.

Mistake 4: Ignoring landscape orientation.

Problem: tablet and phone layouts may break after rotation.

Mistake 5: Using fixed-width design everywhere.

Problem: layout may overflow or look too narrow on different devices.

Fixed width only
   down
good on one screen
bad on many others

29. Mini cheat sheet

responsive design  -> flexible, smooth resizing
adaptive design    -> separate layout states
breakpoint         -> width where styles change
viewport           -> visible area of the web page
layout viewport    -> virtual browser viewport
visual viewport    -> real visible device area
viewport meta tag  -> makes mobile width behave correctly
width=device-width -> use real device width
initial-scale=1.0  -> normal initial zoom

30. Final summary

Modern web pages must look good on many different devices.

Important things to remember:

Super short memory line:

Responsive pages need:
flexible layout + breakpoints + correct viewport meta tag
⬅ Back