Responsive Web Design Playground

Make Websites Fit Every Screen

Responsive design means your page looks great on phones, tablets, and desktops. Drag sliders and watch layouts adapt in real time.

Lab 1

The Viewport Meta Tag

Without this one line, mobile browsers render your page at desktop width and shrink it. With it, your CSS can respond to the actual screen size.

The line that makes everything work

Every responsive page MUST have this in the <head>:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

width=device-width — page width matches the device screen.
initial-scale=1.0 — no zoom when page first loads.

Without this tag, a phone renders your 1200px desktop layout and shrinks it to fit 375px. With it, the phone tells CSS "I'm 375px wide" so your media queries work.

Toggle to see the difference:

Phone (375px)

Desktop (1200px)

HTML
<meta name="viewport" content="width=device-width, initial-scale=1.0">
CSS
<!-- ALWAYS include this in your <head> -->
<meta name="viewport"
      content="width=device-width, initial-scale=1.0">
Lab 2

CSS Units: px vs % vs rem vs vw

Different units behave differently when the screen resizes. Drag the "screen width" slider to see which units are responsive and which are not.

Simulated Screen Width: 800px
Root Font Size: 16px

Summary

px = fixed, never changes.
% = relative to parent width.
rem = relative to root font size.
vw = relative to viewport width.

Quick Widths
200px
pixels (fixed)
50%
percent (of parent)
12rem
rem (of root font)
25vw
vw (viewport width)

Bar width shows relative size at current screen width. Notice: px NEVER changes.

HTML
<div class="box">Content</div>
CSS

          
Lab 3

Media Queries & Breakpoints

Media queries apply different CSS rules at different screen widths. Drag the slider to cross breakpoints and watch the layout change.

How media queries work

@media (max-width: 768px) { ... } means "apply these styles when the screen is 768px or narrower." You set breakpoints where your design starts to look bad, and add new rules to fix it.

Screen Width: 1000px
Breakpoints

Standard breakpoints used in this demo:

480px — Phone
768px — Tablet
1024px — Desktop
Quick Sizes

Active rules: Desktop styles

Phone
Tablet
Desktop
480px
768px
1000px
Logo
Hero Banner
DesignDesign
CodeCode
LaunchLaunch
Sidebar
ContentMain Content Area
HTML
<div class="container">
  <nav>...</nav>
  <div class="cards">...</div>
</div>
CSS

          
Lab 4

Fluid Typography with clamp()

clamp(min, preferred, max) makes text scale smoothly between a minimum and maximum size. No breakpoints needed.

Minimum: 1rem
Preferred: 4vw
Maximum: 3rem
Viewport Width: 800px

How clamp works:
It picks the preferred value (vw), but never goes below the min or above the max. Result: text that scales smoothly.

Presets

Computed size: 24px

Responsive Text

HTML
<h1>Responsive Heading</h1>
CSS

          
Lab 5

Live Resize: Watch a Full Page Respond

Click a device size and watch a real web page adapt. This is what responsive design looks like in practice.

1024px Desktop
HTML
<div class="page">
  <nav>...</nav>
  <main>...</main>
  <footer>...</footer>
</div>
CSS