Inspired by Ungrid and BASSCSS I have decided to combine the power of both... And add gutters.
Columns are magically aligned to have equal width. No need to set sizes just add as many as needed.
You can specify fixed width by using grid classes, the reset of the space will be split between remaining columns.
Align columns to the left, right or center them.
Did I mention vertical alignment and equal height?
But wait, there's more. Just check the examples
<div class="row"> <div class="col"></div> <div class="col"></div> <div class="col"></div> <div class="col"></div> <div class="col"></div> </div>
Using the default $nanogrid-columns: 12
variable you have classes
from .col-1
to .col-12
out of the box providing some creative
freedom.
Other divisions can be generated in SASS by assigning value to $nanogrid-columns
The rest of the space will be occupied equally
<div class="row"> <div class="col-6"></div> <div class="col"></div> <div class="col"></div> </div>
<div class="row"> <div class="col"></div> <div class="col"></div> <div class="col-6"></div> <div class="col"></div> <div class="col"></div> </div>
<div class="row"> <div class="col"></div> <div class="col"></div> <div class="col-6"></div> <div class="col"></div> <div class="col"></div> </div>
Simply set width with .col-X
, in fact you can use .col-x freely on elements. They obey breakpoint.
<div class="col-6"></div>
Since .col-X
just setting up width you don't need anyhing other than .col-center
for centering:
<div class="col-6 col-center"></div>
.col-right
on the other hand requires some form of clearfix (provided):
<div class="clearfix"> <div class="col-6 col-right"></div> </div>
This one is hard to beat using conventional grids.
<div class="row"> <div class="col"></div> <div class="col col-middle"></div> <div class="col col-bottom"></div> </div>
This uses BASSCSS approach so you have to specify widths.
<div class="clearfix"> <div class="col col-4"></div> <div class="col col-4"></div> <div class="col col-4"></div> </div>
You need only one file.
http://firedev.github.io/nanogrid/nanogrid.css
$ git clone http://github.com/firedev/nanogrid
$ bower install nanogrid
source 'https://rails-assets.org' do gem 'rails-assets-nanogrid' end
// import 'nanogrid'
$nanogrid-gutter: 1rem !default $nanogrid-breakpoint: 30rem !default $nanogrid-columns: 12 !default