Skip to main content

Responsive

FlatifyCSS comes with some helper mixins to make your website responsive, if you use Sass in this case these mixins simplify the process of writing media queries.

Responsive breakpoints​

First read about customization. Responsive breakpoints are defined inside the _config.scss file, and based on these breakpoints the mixins will be generated.

_config.scss
$RESPONSIVE_BREAKPOINTS: (
xs: 575.98px,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
xxl: 1400px,
) !default;

Responsive mixins​

Here is the list of all available responsive mixins and the media queries they make with the default breakpoints:

MixinScreenMedia query
break-xs()Extra small(max-width: 575.98px)
break-sm()Small(min-width: 576px) and (max-width: 767px)
break-sm-min()Small and up(min-width: 576px)
break-sm-max()Below small(max-width: 575.98px)
break-md()Medium(min-width: 768px) and (max-width: 991px)
break-md-min()Medium and up(min-width: 768px)
break-md-max()Below medium(max-width: 767.98px)
break-lg()Large(min-width: 992px) and (max-width: 1199px)
break-lg-min()Large and up(min-width: 992px)
break-lg-max()Below large(max-width: 991.98px)
break-xl()Extra large(min-width: 1200px) and (max-width: 1399px)
break-xl-min()Extra large and up(min-width: 1200px)
break-xl-max()Below extra large(max-width: 1199.98px)
break-xxl()Extra extra large and up(min-width: 1400px)
break-xxl-max()Below extra extra large(max-width: 1399.98px)

All of them use screen, for example @media screen and (min-width: 576px).

Use responsive mixins​

The example below indicates how to use the mixins to make conditions for responsive design.

custom-style.scss
body {
padding: 50px;

@include break-sm {
padding: 10px;
}
}

What will be compiled is:

custom-style.css
body {
padding: 50px;
}

/* Small breakpoint */
@media screen and (min-width: 576px) and (max-width: 767px) {
body {
padding: 10px;
}
}