Overview
Powerfull and lightweight CSS layout framework for creating your layout like 'container/row/column' support block, inline-block and flexbox models.
SCSS API
You have simple and usable API to set your custom grid parameters.
| Var | Type | Default | Description |
|---|---|---|---|
| Vars | |||
$columns |
number, unitless | 12 | columns number |
$columns_gap |
number, unitless | 15 | column one side gap |
$container_width |
number, unitless | 1400 | container global max width |
$breakpoints_between |
string,
['responsive' || 'fixed'] |
'responsive' | behavior between breakpoints |
$vertical_alignment_responsive |
number,
[ 0 || 1] |
0 | vertical alignment classes for each device |
| Objects | |||
$display_models |
map | (block: 1, inline-block: 0, flex: 1)) | types of display models |
$devices |
map | see Expamle | devices parameters - breakpoints, container max width, font base, and modular scale coeff for each device |
Variables
$columns
columns is global var. Sets the number of columns in grid.
$columns_gap
columns_gap is global var. Sets the padding between columns.
- Value is column one side gap
- Use CSS-poperty
padding-left,padding-rightfor containers and columns andmargin-left,margin-rightfor rows - Replaced when the 'columns_gap' property is defined on the
$deviceobject
$container_width
container_width is global var. Set container max-width
$breakpoints_between
breakpoints_between is global var. Set behavior between breakpoints - makes containers responsive or fixed with.
$vertical_alignment_responsive
vertical_alignment_responsive is global var. Add utilites (CSS-classes) for vertical aligment
at each breakpoint. For example: .hd_middle
See more in Feaures - Vertical Alignment
Objects
$display_models
display_models is global object. Set display models for columns in row.
They are: block, inline-block, flex.
Your settings are merged with the default and overwritten.
See more in Display models
$devices
devices is global object. Sets settings for each device:
- breakpoint
- container_max
- font_base
- ms_coeff
Device key- is the device name and prefix for columns names and many responsive classes.
breakpoint - breakpoint (viewport width in px) at which the settings take effect
container_max - container max-width for this breakpoint
font_base - font base value. You can use it for modular font scales and etc..
ms_coeff - modular scale coefficient, We use it for modular font scale.
Your settings are merged with the default and overwritten.
Default settings are:
| Mobile Vertical (mv_) 320px |
Mobile Horizontal (mh_) 576px |
Tablets (tb_) 768px |
Desktops (ds_) 1024px |
High Definition (hd_) 1366px |
|
|---|---|---|---|---|---|
| key | mv_ | mh_ | tb_ | ds_ | hd_ |
$breakpoint |
320 | 576 | 768 | 1024 | 1366 |
$container_max |
300 | 540 | 750 | 960 | 1200 |
$font_base |
14px | 14px | 15px | 16px | 16px |
$ms_coeff |
1.10 | 1.10 | 1.17 | 1.17 | 1.17 |
Example
In your SCSS style add options and include mw-grid core, like this:
// Options:
$columns: 12;
$columns_gap: 10;
$container_width: 1200;
$breakpoints_between: 'responsive'; // 'responsive' || 'fixed'
$display_models: (
block: 1,
inline-block: 0,
flex: 1
);
$devices: (
mv_: (
breakpoint: 320,
container_max: 300,
font_base: 14px,
ms_coeff: 1.10,
),
mh_: (
breakpoint: 576,
container_max: 540,
font_base: 14px,
ms_coeff: 1.10,
),
tb_: (
breakpoint: 768,
container_max: 750,
font_base: 15px,
ms_coeff: 1.17,
),
ds_: (
breakpoint: 1024,
container_max: 960,
font_base: 16px,
ms_coeff: 1.17
),
hd_: (
breakpoint: 1366,
container_max: 1200,
font_base: 16px,
ms_coeff: 1.17
)
);
// Import module
@import 'node_modules/mw-grid/src/_mwgrid.scss';
