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

How would you write a media query for screens smaller than 768px?

Writing Media Queries for Small Screens in CSS

To target screens smaller than 768px, you can use the max-width property in a CSS media query. This ensures that the styles inside the query apply only when the viewport width is less than or equal to 768px — typically covering mobile devices and small tablets.

When to Use max-width Media Queries
  1. 1

    For applying styles specifically to mobile or small devices.

  2. 2

    To simplify layouts, hide large elements, or reduce padding and margins on small screens.

  3. 3

    When following a desktop-first design approach (starting from large screens and adjusting downward).

Example: CSS Media Query for Screens Smaller Than 768px

In this example, the styles apply only when the screen width is 768px or smaller. The text size and padding are reduced, and the sidebar is hidden to optimize the layout for mobile users.

Difficulty: 2/10
Topics: media queries, responsive breakpoints, CSS syntax

Scenario Questions

0-2 years experience
  1. 1

    We have a simple landing page and need the navigation to stack vertically on phones. How would you write a media query to target screens smaller than 768px?

  2. 2

    If you add a media query with max-width:768px but the styles aren't applying, what are common reasons?

2-5 years experience
  1. 1

    You're adding a new card component that should display in a two‑column layout on tablets but collapse to one column on smaller screens. Walk me through the media query you’d write and any ordering considerations.

  2. 2

    During QA you notice that on a device with a 767px width the layout still looks like the desktop version. How would you debug the media query and what could be causing the breakage?

5-8 years experience
  1. 1

    Our design system defines breakpoints globally. How would you structure media queries for <768px across many components to avoid duplication and ensure maintainability?

  2. 2

    We need to support high‑density displays and also serve different image assets based on viewport width. How would you integrate media queries with srcset or picture elements while keeping the <768px rule efficient?

8+ years experience
  1. 1

    The product is migrating from a legacy CSS codebase that uses fixed pixel breakpoints to a fluid, design‑token‑driven system. How would you approach refactoring all existing max-width:768px queries to align with the new system without breaking existing pages?

  2. 2

    Across multiple teams you have inconsistent breakpoint definitions. How would you establish a company‑wide strategy for breakpoints like <768px, and what governance or tooling would you put in place to enforce it?

Follow-up Questions

  • What happens if you use min-width instead?
  • How would you combine this with a desktop layout rule?
  • Can you explain why you chose max-width:767px versus 768px?