Breakpoints

Breakpoints are the triggers in Grayshift for how your layout responsive changes across device or viewport sizes.

Core concepts

  • Breakpoints are the building blocks of responsive design. Use them to control when your layout can be adapted at a particular viewport or device size.
  • Use media queries to architect your CSS by breakpoint. Media queries are a feature of CSS that allow you to conditionally apply styles based on a set of browser and operating system parameters. We most commonly use min-width in our media queries.
  • Mobile first, responsive design is the goal. Grayshift’s CSS aims to apply the bare minimum of styles to make a layout work at the smallest breakpoint, and then layers on styles to adjust that design for larger devices. This optimizes your CSS, improves rendering time, and provides a great experience for your visitors.

Available breakpoints

Grayshift includes five default breakpoints, sometimes referred to as grid tiers, for building responsively.

Each breakpoint size was chosen to be a multiple of 12 and to be representative of a subset of common device sizes and viewport dimensions. They don’t specifically target every use case or device, but the provide ranges provide a strong and consistent foundation to build on for any nearly device.

  • xs: 0;
  • sm: 576px;
  • md: 768px;
  • lg: 992px;
  • xl: 1200px;

Media queries

Since Grayshift is developed to be mobile first, we use a handful of media queries to create sensible breakpoints for our layouts and interfaces. These breakpoints are mostly based on minimum viewport widths and allow us to scale up elements as the viewport changes.

Min-width

Grayshift primarily uses the following media query ranges - or breakpoints - in our source CSS files for our layout, grid system, and components.

@media (min-width: 576px) {}

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

@media (min-width: 992px) {}

@media (min-width: 1200px) {}

Max-width

We occasionally use media queries that go in the other direction (the given screen size or smaller).

These mixins take those declared breakpoints, subtract .02px from them, and use them as our max-width values. For example:

@media (max-width: 575.98px) {}

@media (max-width: 767.98px) {}

@media (max-width: 991.98px) {}

@media (max-width: 1199.98px) {}

Why subtract .02px? Browsers don’t currently support range context queries, so we work around the limitations of min- and max- prefixes and viewports with fractional widths (which can occur under certain conditions on high-dpi devices, for instance) by using values with higher precision.