Step by step install the plugin.
npm install zgrid --save
or
yarn add zgrid
or
Download the most recent version from Github and include the unzipped files in your project. Use the top link on this page.
Some examples to help you dig faster ;).
All what you need is to wrap some elements in a div
which has at least one class that contains zg
subset.
Look at the following example. You decide what the columns do. They can change to any size depending on different screen sizes.
In this example you'll notice 3 colored cells that will hide or show when the screen size is changed.
Use ?-start
, ?-center
or ?-end
to align the
columns horizontally.
Use ?-top
, ?-middle
or ?-bottom
to align the
columns vertically.
Use ?-top
, ?-middle
or ?-bottom
to align the
individual columns vertically.
Columns direction can be set from left to right(default) -row
or from right
to left -row-reverse
... use -row
to restore it back to normal direction.
Use ?-space-around
to distribute items evenly.
Items have a half-size space on either end.
Use ?-space-between
to distribute items evenly.
The first item is flush with the start, the last is flush with the end.
Keep the space between columns at the minimum. Use -min-gutter
Keep the space between columns at the maximum. Use -max-gutter
Remove the space between columns. Use -no-gutter
to remove the space between
columns
... and -gutter
to restore it back.
The horizontal is nice and a needed one, but wouldn't it be awesome to have the possibility
of adding on top and bottom of each column. Use the same classes but with the prefix
-v
No problems. Go deeper and don't worry about content. It will fit correctly even if there are 10 nested grids.
<div class="zg">
<div class="cell-xs-6">
<div class="zg">
<div class="cell-xs-6">
<div class="zg">
<div class="cell-xs-6"> ...... </div>
<div class="cell-xs-6"> ...... </div>
</div>
</div>
<div class="cell-xs-6">
<div class="zg">
<div class="cell-xs-6"> ...... </div>
<div class="cell-xs-6"> ...... </div>
</div>
</div>
</div>
</div>
<div class="cell-xs-6">
<div class="zg">
<div class="cell-xs-8"> ...... </div>
<div class="cell-xs-4"> ...... </div>
<div class="cell-xs-4"> ...... </div>
<div class="cell-xs-8"> ...... </div>
</div>
</div>
</div>
Sometimes you just want to set a number of columns and forget about it. You can do it.
Set one of the following class suffixes to grid container and only cell
class to inner elements:
-6columns
,
-5columns
,
-4columns
,
-3columns
,
-2columns
,
-1column
It's possible to display the columns in a vertical direction.
... use -column-reverse
.
... use -column
to restore it back to normal direction.
Use -space-between
,
-space-around
,
-start
,
-center
,
-end
just like you would do in horizontal mode.
Normal ( optional -start
)
Center -center
From end -end
Space between -space-between
Space around -space-around