Overview
Options for laying out your Setka project, including wrapping containers, a powerful grid system, and responsive utility classes.
Containers
Containers provide a means to center and horizontally pad your site’s contents. It's not required when using grid system. Use .container
for a responsive, fixed-width container (meaning its max-width
changes at each breakpoint).
<div class="container"> <!-- Content here --> </div>
Use .container-fluid
for a full width container, spanning 100% width across all viewport and device sizes.
<div class="container-fluid"> ... </div>
Responsive breakpoints
Breakpoint | xs | sm | md | lg | xl |
---|---|---|---|---|---|
Viewport size | all sizes | ≥ 576px | ≥ 768px | ≥ 992px | ≥ 1200px |
Classname | – | .*-sm-* | .*-md-* | .*-lg-* | .*-xl-* |
Since Setka is mobile first, it uses media queries to create sensible breakpoints for our layouts. These breakpoints are mostly based on minimum viewport widths and allow us to scale up elements as the viewport changes.
Setka primarily uses the following media query ranges—or breakpoints—in our source Stylus files for grid system and utilities.
/* Extra small devices (portrait phones, less than 576px) */ /* No media query since this is the default in Setka */ /* Small devices (landscape phones, 576px and up) */ @media (min-width: 576px) { ... } /* Medium devices (tablets, 768px and up) */ @media (min-width: 768px) { ... } /* Large devices (desktops, 992px and up) */ @media (min-width: 992px) { ... } /* Extra large devices (large desktops, 1200px and up) */ @media (min-width: 1200px) { ... }
+media-up('xs') { ... } +media-up('sm') { ... } +media-up('md') { ... } +media-up('lg') { ... } +media-up('xl') { ... } // Example usage: +media-up('sm') .some-class display: block
We occasionally use media queries that go in the other direction (the given screen size or smaller):
/* Extra small devices (portrait phones, less than 576px) */ @media (max-width: 575.98px) { ... } /* Small devices (landscape phones, less than 768px) */ @media (max-width: 767.98px) { ... } /* Medium devices (tablets, less than 992px) */ @media (max-width: 991.98px) { ... } /* Large devices (desktops, less than 1200px) */ @media (max-width: 1199.98px) { ... } /* Extra large devices (large desktops) */ /* No media query since the extra-large breakpoint has no upper bound on its width */
+media-down('xs') { ... } +media-down('sm') { ... } +media-down('md') { ... } +media-down('lg') { ... }
Note that since browsers do not currently support range context queries, 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 for these comparisons.
There are also media queries and mixins for targeting a single segment of screen sizes using the minimum and maximum breakpoint widths.
/* Extra small devices (portrait phones, less than 576px) */ @media (max-width: 575.98px) { ... } /* Small devices (landscape phones, 576px and up) */ @media (min-width: 576px) and (max-width: 767.98px) { ... } /* Medium devices (tablets, 768px and up) */ @media (min-width: 768px) and (max-width: 991.98px) { ... } /* Large devices (desktops, 992px and up) */ @media (min-width: 992px) and (max-width: 1199.98px) { ... } /* Extra large devices (large desktops, 1200px and up) */ @media (min-width: 1200px) { ... }
+media-only('xs') { ... } +media-only('sm') { ... } +media-only('md') { ... } +media-only('lg') { ... } +media-only('xl') { ... }
Similarly, media queries may span multiple breakpoint widths: