Questions
20 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?
20 / 33

How do CSS container queries differ from traditional breakpoints?

Understanding CSS Container Queries vs Traditional Breakpoints

CSS container queries and traditional breakpoints both enable responsive design, but they operate at different levels. Traditional breakpoints use viewport width to adjust styles globally, while container queries apply styles based on the size of a specific container. This allows for more modular and context-aware designs.

Key Differences Between Container Queries and Breakpoints
  1. 1

    Traditional breakpoints depend on the viewport size, affecting the entire page layout.

  2. 2

    Container queries depend on the size of a parent container, allowing components to adapt independently.

  3. 3

    Container queries make components reusable across different layouts without redefining media queries.

  4. 4

    Breakpoints are ideal for page-level layout adjustments, while container queries excel at component-level responsiveness.

Example: Container Query vs Media Query

In this example, the media query adjusts styles when the viewport reaches 768px, while the container query changes the layout when the container itself is at least 500px wide — making the design more modular and adaptive to different contexts.

Difficulty: 6/10
Topics: container queries, responsive design, component isolation

Scenario Questions

0-2 years experience
  1. 1

    You’re building a card component that should show a larger image when it’s wider than 300px — how would you use container queries to make that work, and what happens if you forget to set container-type: inline-size?

  2. 2

    If you have two identical card components side-by-side in a grid, and one is narrower than the other, how would container queries make them behave differently compared to using window media queries?

2-5 years experience
  1. 1

    A team member says the card component breaks when placed inside a modal — the container query doesn’t trigger. What’s the most likely cause, and how would you debug it?

  2. 2

    You’re building a dashboard with reusable widgets. Some widgets are placed in sidebars (narrow) and others in main content (wide). Why might media queries make this hard, and how would container queries improve the architecture?

5-8 years experience
  1. 1

    You’re designing a component library for a design system. How would you structure container queries to ensure components behave predictably across different layouts without requiring parent-specific CSS overrides?

  2. 2

    A performance audit shows layout thrashing when container queries trigger frequently in a dynamic list. What optimizations would you consider, and when would you fall back to media queries instead?

8+ years experience
  1. 1

    You’re migrating a legacy UI built with media-query-driven components to a container-query-based system. How would you prioritize which components to refactor first, and how do you handle teams still relying on viewport-based breakpoints?

  2. 2

    Your company supports a multi-product platform where components are reused across web, mobile web, and embedded widgets. How would you architect the responsive strategy using container queries to balance consistency, performance, and cross-team ownership?

Follow-up Questions

  • Can you give an example where container queries prevented a layout bug you’d seen with media queries?
  • What happens if a container has no explicit width set?
  • How do you handle browser support when using container queries in a production app?