Skip to content

Breakpoint Settings: Key Nodes in Responsive Design โ€‹

Imagine you're designing an adjustable bookshelf system. You won't design a version for every possible space sizeโ€”that would be thousands. Instead, you'd design a few standard sizes (small, medium, large, extra-large) that can cover the vast majority of actual needs. Breakpoints in responsive design play a similar role: they are the critical nodes where you decide to change layouts and styles, allowing your website to perform excellently on various screen sizes.

What Are Breakpoints? โ€‹

Breakpoints are critical values that trigger style changes at specific screen widths. When the viewport crosses a breakpoint, the website's layout, font sizes, image dimensions, etc., adjust accordingly.

css
/* Here 768px and 1024px are breakpoints */
@media (min-width: 768px) {
  /* Apply these styles when screen width โ‰ฅ 768px */
}

@media (min-width: 1024px) {
  /* Apply these styles when screen width โ‰ฅ 1024px */
}

The above code creates two breakpoints, dividing screens into three ranges:

  • Small screens: 0 - 767px (mobile devices)
  • Medium screens: 768px - 1023px (tablet devices)
  • Large screens: 1024px and above (desktop devices)

How to Choose Breakpoints? โ€‹

This is the most critical and error-prone part of responsive design. Let's first look at common wrong approaches, then learn the correct method.

โŒ Wrong Approach: Based on Specific Devices โ€‹

Many beginners think: "I need to design a version for each iPhone 13, iPad Pro, MacBook Air." So they look up the exact screen dimensions of these devices and set breakpoints:

css
/* โŒ Not recommended: targeting specific devices */
@media (min-width: 390px) {
  /* iPhone 13 */
}
@media (min-width: 768px) {
  /* iPad */
}
@media (min-width: 834px) {
  /* iPad Pro 11" */
}
@media (min-width: 1024px) {
  /* iPad Pro 12.9" */
}
@media (min-width: 1280px) {
  /* MacBook Air */
}

What's wrong with this approach?

  1. Devices are constantly changing: Next year there might be new iPhones, new screen sizes
  2. You can't cover all devices: The Android ecosystem has hundreds of different device sizes
  3. Too many breakpoints are hard to maintain: Too many breakpoints make code chaotic
  4. Ignores actual content: You should focus on when content needs adjustment, not specific devices

โœ… Correct Approach: Based on Content โ€‹

The correct breakpoint setting should be determined by the content itself. Steps are as follows:

  1. Start with the smallest screen: Design base styles using mobile-first approach
  2. Gradually expand viewport: Manually drag the window in browser from small screen to larger
  3. Observe when content "breaks": When layout starts to look crowded, text is too long, or elements overlap
  4. Set breakpoint at that point: Add media query right where content starts to feel uncoordinated

Let's look at a practical example:

css
/* Mobile base styles */
.article {
  padding: 15px;
  font-size: 16px;
  line-height: 1.6;
}

/* When you drag window to around 550px, you notice each line of text is too long, hard to read */
@media (min-width: 550px) {
  .article {
    max-width: 600px; /* Limit line width, improve readability */
    margin: 0 auto;
    padding: 20px;
  }
}

/* Continue expanding to 900px, you notice you can now show a sidebar */
@media (min-width: 900px) {
  .container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
  }
}

These breakpoints (550px, 900px) don't correspond to any specific device; they're determined by how the content actually behaves at different widths.

Common Breakpoint Systems โ€‹

Although breakpoints should be based on content, in actual projects, using a standardized breakpoint system is still valuableโ€”it provides consistency and facilitates team collaboration. Here are several popular breakpoint systems.

Bootstrap's Breakpoint System โ€‹

Bootstrap uses the following breakpoints (based on min-width):

css
/* Extra small devices (default, no media query needed) */
/* 0 - 575px */

/* Small devices (sm) */
@media (min-width: 576px) {
}

/* Medium devices (md) */
@media (min-width: 768px) {
}

/* Large devices (lg) */
@media (min-width: 992px) {
}

/* Extra large devices (xl) */
@media (min-width: 1200px) {
}

/* Extra extra large devices (xxl) */
@media (min-width: 1400px) {
}

This system covers various common scenarios from phones to ultra-large desktop displays.

Tailwind CSS's Breakpoint System โ€‹

Tailwind uses a simpler 5-breakpoint system:

css
/* Default (mobile) */
/* 0 - 639px */

/* sm */
@media (min-width: 640px) {
}

/* md */
@media (min-width: 768px) {
}

/* lg */
@media (min-width: 1024px) {
}

/* xl */
@media (min-width: 1280px) {
}

/* 2xl */
@media (min-width: 1536px) {
}

Simplified "Three Breakpoint" System โ€‹

For small to medium projects, a simplified three-breakpoint system is usually sufficient:

css
/* Mobile (default) */
/* 0 - 767px */

/* Tablet and above */
@media (min-width: 768px) {
}

/* Desktop and above */
@media (min-width: 1024px) {
}

This system is simple, clear, easy to understand and maintain, suitable for 80% of project needs.

Using CSS Variables to Manage Breakpoints โ€‹

To improve maintainability, it's recommended to use CSS custom properties (variables) to centrally manage breakpoint values:

css
:root {
  /* Mobile default values */
  --spacing: 15px;
  --font-size: 16px;
  --container-width: 100%;
  --columns: 1;
}

/* Tablet breakpoint */
@media (min-width: 768px) {
  :root {
    --spacing: 20px;
    --font-size: 17px;
    --container-width: 90%;
    --columns: 2;
  }
}

/* Desktop breakpoint */
@media (min-width: 1024px) {
  :root {
    --spacing: 30px;
    --font-size: 18px;
    --container-width: 1200px;
    --columns: 3;
  }
}

/* Use variables */
.container {
  width: var(--container-width);
  padding: var(--spacing);
  font-size: var(--font-size);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--columns), 1fr);
  gap: var(--spacing);
}

The benefits of this approach are:

  • Breakpoint values are centrally defined and easy to modify
  • All components automatically respond to breakpoint changes
  • Reduces duplicate code

Breakpoint Naming Strategies โ€‹

Giving breakpoints good names improves code readability. Common naming approaches include:

css
/* Use universal size names like sm, md, lg, xl */
@media (min-width: 640px) {
  /* sm - small */
}
@media (min-width: 768px) {
  /* md - medium */
}
@media (min-width: 1024px) {
  /* lg - large */
}
@media (min-width: 1280px) {
  /* xl - extra large */
}

Advantages: Not targeting specific devices, highly flexible Disadvantages: Names like sm, md are relatively abstract

css
/* โŒ Not recommended: Although intuitive, it becomes outdated */
@media (min-width: 768px) {
  /* tablet */
}
@media (min-width: 1024px) {
  /* desktop */
}

Problem: As device boundaries blur (like large-screen phones, small-screen laptops), this naming becomes inaccurate.

3. Using SCSS/Sass Variables โ€‹

If you use preprocessors, you can define them like this:

scss
// _variables.scss
$breakpoint-sm: 640px;
$breakpoint-md: 768px;
$breakpoint-lg: 1024px;
$breakpoint-xl: 1280px;

// Usage
.container {
  padding: 15px;

  @media (min-width: $breakpoint-md) {
    padding: 25px;
  }

  @media (min-width: $breakpoint-lg) {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
  }
}

Breakpoint Arrangement Order โ€‹

Mobile First: Small to Large โ€‹

Use min-width media queries, arranged from small screens to large screens:

css
/* Base styles (mobile) */
.container {
  width: 100%;
  padding: 15px;
}

/* Progressive enhancement */
@media (min-width: 640px) {
  .container {
    padding: 20px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
  }
}

Desktop First: Large to Small โ€‹

Use max-width media queries, arranged from large screens to small screens:

css
/* Base styles (desktop) */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px;
}

/* Progressive simplification */
@media (max-width: 1023px) {
  .container {
    padding: 20px;
  }
}

@media (max-width: 639px) {
  .container {
    width: 100%;
    padding: 15px;
  }
}

Mobile-first is recommended because it aligns with progressive enhancement philosophy and performs better on mobile devices.

Range Breakpoints โ€‹

Sometimes you need to apply styles for specific screen width ranges:

css
/* Only effective in tablet range (768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .tablet-only {
    display: block;
  }

  .sidebar {
    width: 250px;
  }
}

This is useful for certain special layout needs, but should be used cautiouslyโ€”too many range breakpoints make code hard to maintain.

Practical Application Cases โ€‹

Case 1: Responsive Grid System โ€‹

css
/* Mobile: Single column */
.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  padding: 15px;
}

/* Large phones/small tablets: 2 columns */
@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
  }
}

/* Tablets: 3 columns */
@media (min-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
  }
}

/* Desktop: 4 columns */
@media (min-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px;
  }
}

/* Ultra-large screens: 5 columns (optional) */
@media (min-width: 1600px) {
  .product-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

Note that these breakpoints are set based on when the grid needs to increase column count, not based on specific devices.

Case 2: Responsive Typography โ€‹

Font sizes should also change with screen size:

css
/* Mobile: Smaller font sizes */
body {
  font-size: 16px;
  line-height: 1.6;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 15px;
}

/* Tablets: Moderately larger */
@media (min-width: 768px) {
  body {
    font-size: 17px;
  }

  h1 {
    font-size: 36px;
    margin-bottom: 20px;
  }
}

/* Desktop: Final sizes */
@media (min-width: 1024px) {
  body {
    font-size: 18px;
    line-height: 1.7;
  }

  h1 {
    font-size: 48px;
    margin-bottom: 30px;
  }
}

Case 3: Complex Component Breakpoint Strategy โ€‹

For complex components, you might need to completely change structure at different breakpoints:

css
/* Mobile: Vertical stacking */
.hero {
  display: flex;
  flex-direction: column;
}

.hero-image {
  width: 100%;
  order: 1; /* Image on top */
}

.hero-content {
  width: 100%;
  padding: 20px;
  order: 2; /* Content below */
}

/* Tablets: Start using horizontal layout */
@media (min-width: 768px) {
  .hero {
    flex-direction: row;
  }

  .hero-image,
  .hero-content {
    width: 50%;
  }

  .hero-content {
    padding: 30px;
  }
}

/* Desktop: Adjust proportions and spacing */
@media (min-width: 1024px) {
  .hero-image {
    width: 60%;
  }

  .hero-content {
    width: 40%;
    padding: 50px;
  }
}

Common Traps and Solutions โ€‹

Trap 1: Too Many Breakpoints โ€‹

css
/* โŒ Problem: Too many breakpoints, hard to maintain */
@media (min-width: 320px) {
}
@media (min-width: 375px) {
}
@media (min-width: 425px) {
}
@media (min-width: 768px) {
}
@media (min-width: 1024px) {
}
@media (min-width: 1440px) {
}
@media (min-width: 2560px) {
}

Solution: Limit breakpoint count (usually 3-5 are enough), use more flexible layout techniques (like Flexbox, Grid) to auto-adapt:

css
/* โœ… Better: Use adaptive layout to reduce breakpoint dependency */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

This Grid layout automatically adjusts column count based on available space, without needing multiple breakpoints.

Trap 2: Overlapping or Discontinuous Breakpoint Values โ€‹

css
/* โŒ Problem: Breakpoints overlap, 768px devices match both rules */
@media (max-width: 768px) {
}
@media (min-width: 768px) {
}

Solution: Ensure breakpoint values are continuous but don't overlap:

css
/* โœ… Correct: Use 767px and 768px to avoid overlap */
@media (max-width: 767px) {
}
@media (min-width: 768px) {
}

/* Or only use min-width (mobile first) */
@media (min-width: 768px) {
}
@media (min-width: 1024px) {
}

Trap 3: Hardcoded Breakpoint Values โ€‹

css
/* โŒ Problem: Breakpoint values scattered everywhere, hard to modify uniformly */
@media (min-width: 768px) {
}
/* ...hundreds of lines of code... */
@media (min-width: 768px) {
}
/* If you want to change to 800px, you need global search and replace */

Solution: Use CSS variables or preprocessors for centralized management:

scss
// SCSS style
$bp-tablet: 768px;
$bp-desktop: 1024px;

.container {
  @media (min-width: $bp-tablet) {
  }
  @media (min-width: $bp-desktop) {
  }
}

Testing Breakpoints โ€‹

Using Browser Developer Tools โ€‹

  1. Open Chrome DevTools (F12)
  2. Click "Toggle device toolbar" (Ctrl+Shift+M)
  3. Select different devices or custom sizes for testing
  4. Drag window edges to observe layout changes when breakpoints trigger

Real Device Testing โ€‹

Simulators are useful, but real device testing is indispensable:

  • iOS: Test on iPhone and iPad Safari
  • Android: Test on Chrome browsers of different brands
  • Consider landscape mode: Many developers forget to test device rotation performance

Automated Testing Tools โ€‹

  • BrowserStack: Test on real devices
  • Responsively App: Free responsive design testing tool
  • Chrome Lighthouse: Check mobile performance and experience

Best Practice Summary โ€‹

  1. Set breakpoints based on content: Don't target specific devices, but observe when content needs adjustment

  2. Limit breakpoint count: Usually 3-5 breakpoints are sufficient; too many increase complexity

  3. Use mobile first: Start with small screens, use min-width for progressive enhancement

  4. Centralize breakpoint values: Use variables or constants for easy unified modification

  5. Maintain breakpoint consistency: Use the same breakpoint system throughout the project

  6. Utilize modern layouts: Flexbox and Grid can reduce dependency on breakpoints

  7. Test edge cases: Test not just breakpoint sides, but also sizes close to breakpoints

  8. Consider orientation changes: Don't forget landscape mode testing

Summary โ€‹

Breakpoints are the skeleton of responsive design; they determine how your website presents on different screens. Scientifically setting breakpoints requires balancing multiple factors:

  • Content first: Let content determine breakpoints, not devices
  • Simplicity: Use sufficient but not excessive breakpoints
  • Maintainability: Centralized management, clear naming, maintain consistency
  • Flexibility: Combine with modern layout techniques to reduce hard dependency on breakpoints

Breakpoints are not the ultimate goal, but a means to achieve the goal. The best responsive design is one that can present gracefully even on screen sizes you didn't anticipate. This requires thoughtful breakpoint strategy combined with flexible layout techniques.