Breakpoints
We try to follow mobile first approach as it has been proven it generates less code an is easier to maintain. When creating a mobile layout it is usually a single column stack with margins and padding, which is already native for HTML elements. On the other hand, deskotop layouts are more complex with flexbox and grid, which deviates form native HTML layout.
Style for mobile, structure (think) for desktop!
When setting up a component the initial style should be for mobile-first as that will have less code. Usually the desktop is more complex which will required a different HTML structure from mobile. For this reason, the structure should reflect the desktop structure.
Deciding on a specific list of breakpoints can be a subjective topic.
In favor of standardization throughout our projects, here is the proposed list of breakpoints:
| Name | Minimal Width |
|---|---|
| mobile | 0 |
| phablet | 600px |
| tablet | 768px |
| laptop | 1024px |
| desktop | 1200px |
| large | 1400px |
SCSS
$site-breakpoints: (
phablet: 600px,
tablet: 768px,
laptop: 1024px,
desktop: 1200px,
large: 1400px,
);Use the following mixins to write media queries based on the enum above.
// Makes the @content apply to the given breakpoint and wider.
@include media-breakpoint-up();
// Makes the @content apply to the given breakpoint and narrower.
@include media-breakpoint-down();
// Makes the @content apply between the min and max breakpoints
@include media-breakpoint-between();
// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.
@include media-breakpoint-only();Example
@include media-breakpoint-up(tablet) {
body { font-size: 87%; }
}Resolutions
Bellow is the table with the most common device screen resolutions. For more details refer to CSS Media Query Breakpoints.
| Category | Width | Device |
|---|---|---|
| Mobile, portrait | 320px | iPhone SE |
| 375px | iPhone 6, 7, 8, X | |
| 414px | iPhone 8 Plus | |
| Mobile, landscape | 568px | iPhone SE |
| 667px | iPhone 6, 7, 8 | |
| 736px | iPhone 8 Plus | |
| 812px | iPhone X | |
| Tablet, portrait | 768px | iPad Air, iPad Mini, iPad Pro 9" |
| 834px | iPad Pro 10" | |
| Tablet, landscape | 1024px | iPad Air, iPad Mini, iPad Pro 9" |
| 1024px | iPad Pro 12" (portrait) | |
| 1112px | iPad Pro 10" | |
| Laptop displays | 1366px | HD laptops (768p) |
| 1366px | iPad Pro 12" (landscape) | |
| 1440px | 13" MacBook Pro (2x scaling) | |
| Desktop displays | 1680px | 13" MacBook Pro (1.5x scaling) |
| 1920px | 1080p displays |