Skip to main content
1.0.0Next5.1.05.0.35.0.25.0.15.0.04.0.94.0.84.0.73.2.03.1.03.0.13.0.02.1.12.0.101.0.0
Version: 1.0.0

Responsive Web Design

A media query is a CSS technique introduced in CSS3. It uses the @media rule to include a block of CSS properties only if a certain condition is true.

When Ethan Marcotte first coined the term “Responsive Web Design” back in 2010, he pointed out that, in addition to a fluid grid and flexible images, media queries was the last crucial ingredient in making a website responsive.

We use media queries in a conservative way, mainly checking for conditions around screen width.

The media query syntax can be quite verbose, so to help write simpler code, we use a library called Sass MQ.

The design system provides a set of predefined breakpoints, This makes responsive layout clean, simple, and predictable.

In _conf_mq.scss you’ll find our configuration for Sass MQ.

Breakpoints

We base our available breakpoints on suggestions from Google. They cover a wide range of common device widths.

BreakpointSizeDescriptionColumns
all0from 0px and up12
mob-s320pxMobile small12
mob-m375pxMobile medium12
tab-s600pxTablet small12
tab-m768pxTablet medium12
tab-l1024pxTablet large12
ltp-s1280pxLaptop small12
ltp-m1440pxLaptop medium12
dtp1920pxdesktop12

Try to avoid using other breakpoints than these, as they should give a sufficient and predictable set of options.

Syntax using Sass MQ

When writing a media query using Sass MQ, the syntax is quite simple:

// Scss
.foo {
@include mq($until: tab-m) {
color: red;
}

@include mq($from: tab-m, $until: dtp) {
color: green;
}

@include mq($from: dtp) {
color: blue;
}
}

This compiles to:

// Css
// Up to medium tablet (768px)
@media screen and (max-width: 48.0525em) {
.foo {
color: red;
}
}

// Between medium tablet (769px) and large laptop (1600px)
@media screen and (min-width: 48.0625em) and (max-width: 100.0525em) {
.foo {
color: green;
}
}

// From large laptop (1601px)
@media screen and (min-width: 100.0625em) {
.foo {
color: blue;
}
}

Please see the documentation for Sass MQ for more options.

Breakpoint Graph

Here is a complete overview of variations using the predefined breakpoints combined with parameters $from, $until and combinations of both (between).

<!-- BUTTON-GROUP Component -->
<div class="kx-btngroup kx-flex kx-flex-wrap kx-ui" role="group" aria-label="Download Breakpoint Graph"><!-- LINK AS BUTTON Component -->
<a class="kx-btn kx-btn--skin-secondary kx-btn--size-large" href="/assets/img/doc/Breakpoint-graph.png">
<span class="kx-btn__inner">
<span class="kx-btn__txt">Download PNG</span>
</span>
</a>
<!-- LINK AS BUTTON Component -->
<a class="kx-btn kx-btn--skin-secondary kx-btn--size-large" href="/assets/img/doc/breakpoint-graph.svg">
<span class="kx-btn__inner">
<span class="kx-btn__txt">Download SVG</span>
</span>
</a>
</div>

<!-- ![alt text](/assets/img/doc/Breakpoint-graph.png "Breakpoint Graph") -->
<!-- Content ends here -->
<div class="learn-more">

</div>
</div>