Documentation of media queries, grids, wrappers and layout utility classes.
Files
app/styles/utils/_media.scss
app/styles/layout/_grid.scss
Media queries
There are three main media queries for screen layouts: S, M, L; and two supplementary media queries XS and XL. Breakpoints for these layouts are described bellow.
Breakpoints
- XL
- width > 1240px
- L
- width < 1239px
- M
- width < 959px
- S
- width < 639px
- XS
- width < 479px
Mixins
@include media-w-xl {
... styles XL ...
}
@include media-w-l {
... styles L ...
}
@include media-w-m {
... styles M ...
}
@include media-w-s {
... styles S ...
}
@include media-w-xs {
... styles XS ...
}
Wrappers
By default there is one main wrapper class .wrapper-main
.
- wrapper-main
- width: 960px
<div class='wrapper-main'>
...
</div>
Grid 12
Grid 12 consists of 12 columns and 5 different media layouts XL / L / M / S / XS.
Note
Start by creating horizontal container with a class of .row
. Now you can add elements with a class of .col
and specify width of each with .col-[xs/s/m/l/xl]-[1-12]
, where layout is one of xl/l/m/s/xs and width is number 1-12.
Warning
Media queries for layouts are set by max width, so for example stuff for layout M inherit also in S and XS.
Basic
<div class="row">
<div class="col col-l-3 col-xl-4 col-m-5 col-s-12"> ... </div>
<div class="col col-l-6 col-xl-4 col-m-7 col-s-12"> ... </div>
<div class="col col-l-3 col-xl-4 col-m-12 col-s-12"> ... </div>
</div>
<div class="row">
<div class="col col-l-4 col-xl-4 col-m-5 col-s-12"> ... </div>
<div class="col col-l-8 col-xl-8 col-m-7 col-s-12"> ... </div>
</div>
<div class="row">
<div class="col col-l-6 col-xl-7 col-xs-12"> ... </div>
<div class="col col-l-6 col-xl-5 col-xs-12"> ... </div>
</div>
Nesting
Rows and columns can be also nested.
<div class="row">
<div class="col col-l-3 col-m-12"> ... </div>
<div class="col col-l-9 col-m-12">
<div class="row">
<div class="col col-l-6 col-xs-12"> ... </div>
<div class="col col-l-6 col-xs-12"> ... </div>
</div>
</div>
</div>
Offsets
Colums can be moved to the right by using classes like .ofst-[xs/s/m/l/xl]-[0-11]
. You can also center column with class .ofst-[xs/s/m/l/xl]-center
.
<div class="row">
<div class="col col-l-3 col-m-4 col-s-5 ofst-s-1 col-xs-6 ofst-xs-0">
...
</div>
<div class="col col-l-8 ofst-l-1 ofst-m-0 col-s-10 ofst-s-1 col-xs-12 ofst-xs-0">
...
</div>
</div>
<div class="row">
<div class="col col-l-8 ofst-l-center col-m-10 col-xs-12">
...
</div>
</div>
Vertical space
Vertical space between rows can be created by using class .row-[xs/s/m/l/xl]-space
and vertical space between columns can be created by using class .col-[xs/s/m/l/xl]-space
.
Note
In case you need to reset space you can use .row-[xs/s/m/l/xl]-nospace
and .col-[xs/s/m/l/xl]-nospace
<div class="row row-l-space row-m-nospace">
<div class="col col-l-12">
...
</div>
</div>
<div class="row row-l-space row-m-nospace">
<div class="col col-l-6 col-m-12 col-m-space">
...
</div>
<div class="col col-l-6 col-m-12 col-m-space">
...
</div>
</div>
Utilities
Grid utilities contains basic classes for utility like pull right/left, clearfix, margin/padding resets, hide classes etc.
Some utilities can be set for specific layout by adding postfix representing layout. These postfixes are not needed in case you don't want target specific layout.
List of utility classes:
.pull-[xs/s/m/l/xl]-left
.pull-[xs/s/m/l/xl]-right
.pull-[xs/s/m/l/xl]-center
.inline-block-[xs/s/m/l/xl]
Warning
Layout L (Large), don't need postix.
Use these classes wise and only if needed since they use !important
directive !
<div class="clearfix">
<div class="pull-left pull-m-right inline-block-s pull-xs-center">
...
</div>
</div>
Layout hacks
These utilities provides hacks as clearfix or center-unknown.
List of layout hacks classes:
.clearfix
.center-unknown
.clear
<div class="clearfix">
... floating elements ...
</div>
<div class="center-unknown">
... unknown element to be centered ...
</div>
<div class="clear"> ... </div>
Space resets
Use classes like .no-pad
or .no-mrg
to reset margins or paddings. Target specific layout with .no-mrg-[xs/s/m/xl]
and .no-pad-[xs/s/m/xl]
.
<div class="no-mrg"> reset margins </div>
<div class="no-mrg-top"> reset top margin </div>
<div class="no-mrg-bottom"> reset bottom margin </div>
<div class="no-mrg-left"> reset left margin </div>
<div class="no-mrg-right"> reset right margin </div>
<div class="no-mrg-vertical"> reset top and bottom margin </div>
<div class="no-mrg-horizontal"> reset left and right margin </div>
<div class="mrg-t-10"> set top margin 10px </div>
<div class="no-pad"> reset padding </div>
<div class="no-pad-top"> reset padding-top </div>
<div class="no-pad-bottom"> reset padding-bottom </div>
<div class="no-pad-left"> reset left padding </div>
<div class="no-pad-right"> reset right padding </div>
<div class="no-pad-vertical"> reset top and bottom padding </div>
<div class="no-pad-horizontal"> reset left and right padding </div>
Hide
You can hide elements for specific layout by using classes like .hide-[xs/s/m/l/xl]-only
or for all layouts lower including specified by classes like .hide-[xs/s/m/l/xl]
.
Note
Hide for 'XL and lower' and 'XS and lower' are worthless. In first case you hide for all layouts and in second case there is no lower than XS.