▥ Flex Box Grid
Responsive, mobile first Flexbox Grid
- Demo & Documentation
- Browsers Support
npm install flex-box-grid
and use CSS or Sass version from
Download css and include inside
Download flexboxgrid.zip. Extract it to Sass working directory
Demo and most detailed documentation you can find here "Flex Box Grid Demo & Documentation").
Flex Box Grid systems are used for creating page layouts through a series of rows and columns that house your content. By default Flex Box Grid have 12 columns.
- Rows must be placed within a
.containerwith predefined paddings that equal half column gutter.
- Use rows .row to create horizontal groups of columns.
- Content should be placed within columns with classes
.X-n, .S-n, .M-n, .L-n, .XL-nwhere n is columns number from 1 to 12 (by default).
- Columns create gutters (gaps between column content) via padding. That padding is offset in rows for the first and last column via negative margin on
.row, by default it's 10px.
... * 12............... * 3
Media queries is a basis of any Responsive Grid System. To change column behavior each media query breakpoint connected with column class name with simply recognizing size name:
X, S, M, L, XL.
As example column with
.M6 class will be halfwidth until the window width becomes equal to 768px or less matching
Predefined break points:
To change column content behavior...
...use appropriate media query
Wanna different behavior on multiple devices? Try to mix columns.
You can mix any number of different grid classes
Grid columns can be nested one into another.
Move columns right using
--offsetN suffix on grid classes. These will increase left indent of a column. As example
.M6 block over 2 columns.
Grid columns order can be changed in any way with
You can change swap blocks position on different devices. No need to duplicate blocks anymore.
Well, hard to say what for, but columns can be also reversed with
There is predefined classes for horizontal alignment with
There is also predefined classes for vertical alignment with
Also you can do full height stretch with
Another helpful feature can be distribution columns space between or around columns.
IE / Edge
Chrome for Android
|IE10, IE11, Edge||last 2 versions||last 2 versions||last 2 versions||last 2 versions||last 2 versions||last 2 versions||last 2 versions|
What is Grid?
The vast majority of websites out there use a grid. They may not explicitly have a grid system in place, but if they have a "main content area" floated to the left a "sidebar" floated to the right, it's a simple grid.
Why use Grid at all?
Using grid system can significant speed up your work, keep you code understandable, solid and DRY.
Why use Flexbox Grid System (FGS) instead float one?
Simply. It's more flexible :) FGS provides you not only the same functionality as float one, it allows significant expand Grid functionality with sorting, reordering, aligning and distribution features.
If you can't say, "Screw IE9" you probably not ready for Flexboxes model in general yet.
Also at the moment FGS should contain vendor prefixes
-ms- for IE10 and
-webkit- for Safari, which increase little bit styles size.
Why use Flex Box Grid? What alternatives are exist?
I tried to use Foundation Grid by Zurb, Flexbox Grid by Kristofer Joseph, Solved by Flexbox by Philip Walton and others. All of them not bad, but in my opinion too complicated for first meet, have specific namespaces and have not full features that Flexboxes model provides.
Flex Box Grid uses simple object oriented name spacing, provides ease customization via Sass variables and have full list of Flexbox features.