Questions
14 of 33
1What is a breakpoint in CSS? Why are breakpoints used in responsive web design?
2What is the syntax for setting a breakpoint using a media query?
3What is the syntax for setting a breakpoint using a media query?
4What units are typically used for defining breakpoints (e.g., px, em, rem)?
5What happens if no breakpoints are defined in a responsive layout?
6How do breakpoints help in mobile-first design?
7How does CSS decide which breakpoint to apply when multiple match?
8What’s the difference between min-width and max-width in media queries?
9How can you create a layout that adjusts between two breakpoints?
10What is the difference between device-based breakpoints and content-based breakpoints?
11What is the role of the viewport meta tag in responsive design?
12How do breakpoints help in mobile-first design?
13How does CSS decide which breakpoint to apply when multiple match?
14What’s the difference between min-width and max-width in media queries?
15What is the difference between device-based breakpoints and content-based breakpoints?
16What is the role of the viewport meta tag in responsive design?
17What is the difference between using em and px in defining breakpoints?
18How do you handle overlapping or conflicting breakpoint rules?
19Can breakpoints be combined with CSS Grid or Flexbox?
20How do CSS container queries differ from traditional breakpoints?
21How can you implement responsive typography using breakpoints?
22How can you use logical operators (and, not, only) in media queries?
23How does pixel density (device-pixel-ratio) affect breakpoints?
24What is the difference between min-device-width and min-width?
25How do you use breakpoints in frameworks like Bootstrap or Tailwind CSS?
26How would you write a media query for screens smaller than 768px?
27How would you create a responsive navigation bar using breakpoints?
28How would you handle images that need to resize at specific breakpoints? How can you make font sizes scale smoothly between two breakpoints?
29How would you debug a layout that looks broken at a specific breakpoint?
30How would you optimize breakpoints for tablets vs. phones?
31How can you prevent layout jumps between breakpoints?
32How do you use CSS custom properties (variables) with breakpoints?
33How do breakpoints differ between desktop, tablet, and mobile-first strategies?
14 / 33

What’s the difference between min-width and max-width in media queries?

Understanding min-width and max-width in CSS Media Queries

The min-width and max-width properties in media queries define the conditions under which certain CSS rules are applied, based on the width of the viewport. They are used to create responsive designs that adapt to different screen sizes.

Key Differences Between min-width and max-width
  1. 1

    min-width applies styles when the viewport is greater than or equal to a specified width (used in mobile-first design).

  2. 2

    max-width applies styles when the viewport is less than or equal to a specified width (used in desktop-first design).

  3. 3

    Using min-width allows styles to build up as screens get larger, while max-width works by removing or overriding styles as screens get smaller.

  4. 4

    min-width queries are typically written in ascending order, while max-width queries are written in descending order.

Example: min-width vs max-width

In this example, min-width is used to add styles as the viewport expands (mobile-first), while max-width applies styles when the viewport is smaller than the defined width (desktop-first).

Difficulty: 3/10
Topics: media query breakpoints, responsive layout behavior, CSS cascade order

Scenario Questions

0-2 years experience
  1. 1

    You’re building a card component that should be full-width on mobile but 50% wide on desktop. You used max-width: 768px for the mobile styles, but it’s not working on a 768px tablet—what’s likely wrong?

  2. 2

    How would you write a media query to show a sidebar only when the screen is wider than 1024px, and hide it otherwise?

  3. 3

    If you set min-width: 600px and max-width: 800px on the same element, what screen sizes will actually apply those styles?

2-5 years experience
  1. 1

    A user reports that our product page looks broken on an iPad Pro—everything’s too narrow. You’ve got media queries using max-width, but the device reports a width of 1024px. What’s the most likely cause and how would you fix it?

  2. 2

    Your team’s responsive grid breaks when resizing between 768px and 1024px because two media queries overlap. How would you diagnose and resolve this without rewriting everything?

  3. 3

    We’re using max-width for mobile styles and min-width for desktop, but now we need to support foldable phones with weird aspect ratios. What tradeoffs do you consider when switching to min-width-only or fluid breakpoints?

5-8 years experience
  1. 1

    Our design system has 12 breakpoints across components, and performance is suffering on low-end devices. How would you redesign the media query strategy to reduce repaints and CSS complexity while maintaining responsiveness?

  2. 2

    You’re inheriting a legacy codebase where min-width and max-width are used inconsistently—some components use mobile-first, others desktop-first. How would you refactor this to improve maintainability and reduce bugs during future updates?

  3. 3

    A third-party widget breaks our layout on high-DPI screens because it triggers a different media query than our app. How do you isolate and fix this without modifying the widget, and how do you prevent this in future integrations?

8+ years experience
  1. 1

    We’re migrating from a legacy desktop-first CSS architecture to a mobile-first one across 50+ products. How do you design a phased rollout strategy for media queries that minimizes regressions and aligns with cross-team design systems?

  2. 2

    Our global product has users on devices with wildly varying viewport widths due to regional device fragmentation. How would you architect a scalable, maintainable responsive strategy that doesn’t rely on fixed breakpoints and can adapt to future form factors?

  3. 3

    A major partner requires our UI to render identically in a 320px iframe embedded in their app. Our media queries assume full viewport context. How do you solve this without breaking our responsive design elsewhere, and what long-term architectural changes would you propose?

Follow-up Questions

  • What happens if you have both min-width and max-width on the same rule?
  • How would you debug a layout that looks wrong on a tablet but fine on desktop?
  • Why might a mobile-first design prefer min-width over max-width?