Welcome to Arc D: Responsive Design
You've learned HTML structure and CSS styling. Now comes a critical skill: making your pages work on every device. In 2026, over 75% of web traffic comes from mobile devices. A website that looks beautiful on your 27-inch monitor but is broken on a phone is a broken website.
Arc D teaches you responsive design โ the modern approach to building websites that adapt to any screen size. By the end of this arc, you'll understand viewport meta tags, fluid layouts, mobile-first CSS, and responsive images.
The viewport meta tag
The first step to responsive design is telling the browser how to render your page on mobile. Without the viewport meta tag, mobile browsers assume your page is designed for desktop and zoom out, making text tiny and unreadable.
Let's break down the viewport meta tag:
width=device-widthโ Sets the viewport width to match the device's actual width. On a phone, this is typically 375px. On a tablet, 768px. On a desktop, 1920px or more.initial-scale=1.0โ Sets the initial zoom level to 100% (no zoom). The page starts at normal size, not zoomed in or out.
Always include this line in every HTML page you create. Without it, your responsive CSS won't work on mobile devices.
user-scalable=no in older pages. Don't use it โ users have the right to zoom if they need to. Always allow zooming.
Fluid widths: %, vw, and vh
Fixed pixel widths break on small screens. If you set a container to width: 1000px, it overflows on a phone. The solution: fluid widths that adapt to the viewport.
Key fluid units:
%โ Relative to the parent container. Use for layout widths (containers, columns, sections).vwโ Viewport width. 1vw = 1% of the browser window width. Use sparingly for full-viewport designs.vhโ Viewport height. 1vh = 1% of the browser window height. Great for hero sections that fill the screen.clamp(min, preferred, max)โ Smart scaling. The value scales, but never goes belowminor abovemax.
width: 90% with max-width to stay readable on large screens while fitting phones. Never use fixed pixel widths for layout.
Try it yourself: Fluid widths
Edit the CSS below. Change the container width, adjust the max-width, and watch how the layout adapts as you resize your window.
Responsive images
Images are often the culprit in unresponsive designs. A 2000px-wide image on a phone is ridiculous โ it overflows, forces horizontal scrolling, and wastes bandwidth.
The golden rules for responsive images:
max-width: 100%โ The image never stretches wider than its container.height: autoโ The height scales proportionally so the image doesn't distort.object-fit: cover(optional) โ Crop the image to fill its container while maintaining aspect ratio.
max-width: 100% but also use responsive image formats like WebP and size images appropriately before uploading. Large images waste bandwidth on mobile.
Mobile-first CSS approach
There are two ways to write responsive CSS:
- Desktop-first: Write CSS for desktop, then use media queries to shrink for mobile. This often leads to bloated, complex code.
- Mobile-first (recommended): Write CSS for mobile first (the smallest screen), then use media queries to enhance for larger screens. This results in cleaner, faster code.
Mobile-first is recommended because:
- Most users are on mobile โ optimize for them first.
- Progressive enhancement: Start simple, add features for capable devices.
- Smaller CSS file size (fewer overrides).
- Forces you to think about performance and usability from the start.
Notice the pattern: base styles (mobile), then @media (min-width: 768px) for tablets, then @media (min-width: 1024px) for desktops. This is mobile-first.
Try it yourself: Mobile-first CSS
This example starts with single-column mobile layout and expands to multiple columns on larger screens. Resize your browser to see the layout change.
Key concepts recap
- Viewport meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1.0">is essential. It tells mobile browsers to render at device width, not zoomed out. - Fluid widths: Use
%,vw,vh, andclamp()instead of fixed pixel widths. Never setwidth: 1000pxon a layout. - Responsive images: Always use
max-width: 100%andheight: autoso images scale with their container. - Mobile-first: Write base CSS for mobile (small screens), then expand with
@mediaqueries for tablets and desktops. - Media queries: Use
@media (min-width: 768px)and up, notmax-width. This keeps mobile CSS clean and uncluttered.
Task: Create a responsive page with:
- The viewport meta tag (required!)
- A fluid container using
width: 90%; max-width: 1000px; - A responsive image with
max-width: 100%; height: auto; - Fluid typography using
clamp()for the heading - A mobile-first grid: 1 column on mobile, 2 on tablet (640px+), 3 on desktop (1024px+)
Hint: Start with the mobile layout. Write all your base CSS for small screens first. Then add @media (min-width: 640px) and @media (min-width: 1024px) blocks to enhance for larger screens. Remember: mobile first!
Key takeaways
- Always include the viewport meta tag. Without it, mobile browsers won't render your responsive CSS correctly.
- Never use fixed pixel widths for layout. Use
%,vw,vh, andclamp()instead. - Images need
max-width: 100%andheight: autoto scale responsively. - Mobile-first CSS is the modern standard. Write for small screens first, then enhance for larger screens with media queries.
- Responsive design isn't a luxury โ it's a requirement. Over 75% of users browse on mobile.
Test your knowledge
width=device-width do?max-width: 100% do on images?You just built responsive pages.
Imagine the full-stack sites you'll create next.
Join the Best AI Programs โ three 5-month courses, fully online, with placement assistance. Week 1 is free.
Explore our AI-era courses โ