Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Responsive Design – Meta Viewport and M | HTML Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. HTML Course

Lesson 18 of 55

·HTML

Responsive Design – Meta Viewport and Media Queries

9 min

Course progress33%

What you'll learn

Keep these ideas in mind as you work through the lesson.

5 points
  • Purpose of the viewport meta tag and its impact on mobile rendering
  • Media query syntax (`@media`) and best‑practice breakpoint strategy
  • Mobile‑first design workflow (base styles → `min-width` overrides)
  • Responsive units (`rem`, `vw`, `%`) versus fixed pixels
  • Testing responsive layouts with device emulation tools

Building for All Screens

Meta viewport

<meta name='viewport' content='width=device-width, initial-scale=1' />

Ensures the page scales correctly on mobile devices and prevents the browser from zooming out to fit the entire page.

Media queries

@media (max-width: 600px) {
  .sidebar { display: none; }
  .content { margin: 0; }
}

Combine media queries with Flexbox or CSS Grid to adapt layouts fluidly.

Mobile‑first strategy

Start with base styles for the smallest screens, then add @media (min-width: …) rules for larger breakpoints. This approach loads only the essential CSS first and reduces unnecessary overrides.

Common breakpoints (adjust to your audience)

  • 320 px – Small phones
  • 480 px – Large phones
  • 768 px – Tablets
  • 1024 px – Small laptops
  • 1280 px – Desktops

Responsive units

  • rem – Relative to the root font size; good for scalable typography.
  • vw / vh – 1 % of the viewport width/height.
  • % – Relative to the parent element.

Quick checklist for responsive design

  1. <meta name='viewport'> present? ✅
  2. Base styles target mobile first? ✅
  3. Media queries use min-width for larger screens? ✅
  4. Layout built with Flexbox/Grid, not floats? ✅
  5. No fixed‑pixel widths for major layout containers? ✅

Tip: Test your layouts with Chrome DevTools → Device Toolbar to emulate various screen sizes.

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from HTML CourseBrowse activities
Previous lessonInline vs External CSSContinue to lesson 19Flexbox LayoutBack to HTML Course curriculum