UI ELEMENTS
Ink provides a layout grid system that is flexible, responsive and uses a human readable syntax.
Our layout grid was built to allow precise control on how horizontal space is divided and on targeting several screen sizes. To accomplish this, we use percentages as our base units and CSS @media queries to allow you to decide what width should an element take when viewed in a specific screen size.
Our default layout breakpoints are:
tiny
for screens widths up to 320px.small
for screen widths between 321 and 640 pixels.medium
for screen widths between 641 and 960 pixels.large
for screen widths between 961 and 1260 pixels.xlarge
for screen widths above 1261 pixels.Class name | Description |
---|---|
ink-grid |
The grid root class. |
column-group |
Groups layout columns. |
gutters |
Add space between layout columns. |
all-x% |
Sets x% element width for all breakpoints. |
tiny-x% |
Sets x% element width for the 'tiny' breakpoint. |
small-x% |
Sets x% element width for the 'small' breakpoint. |
medium-x% |
Sets x% element width for the 'medium' breakpoint. |
large-x% |
Sets x% element width for the 'large' breakpoint. |
xlarge-x% |
Sets element x% width for the 'xlarge' breakpoint. |
large-class-name
.half-class-name
.We have 22 width units, that we'll call columns, ranging from 5% to 100% in 5% increments as well as 33% and 66% for one and two thirds respectively.
All column elements must be inside a column-group
element:
Example
The example above creates a 50/50 two column layout for all screens.
Grid elements can be nested to create more intricate layouts:
Example
The example above further divides each of the 50% columns in to 3 thirds and 4 fourths.
Gutters are the space between columns of printed text.
In ink we use the term to describe the space between layout columns.
Horizontal spacing is created by adding padding to the left of the columns and using the border-box box model. Vertical spacing is created with a bottom margin. So, if you want to add a background to a column, you'll need to add an additional element inside it.
To add space between a group of columns in your layout add the gutters
class to the parent column-group
element. You can also choose the amount of gutter space by using half-gutters
or quarter-gutters
classes to halve or quarter your column gutters.
Example
Gutters are applied only to the column-group
direct children. Nested elements are left untouched.
Example
In the example above half sized gutters are added on the large breakpoint only.
Handling layout changes for multiple screen sizes is as simple as adding a few more classes to your markup.
Example
To set the width of a grid column just add the desired width percentage class for the targeted breakpoint: large-50 small-100 ...
.
If you need your layout to work on multiple screens, you'll have to declare the width for all available breakpoints.
You can also set a width for all breakpoints by using the all-
prefix:
Try resizing your browser window to see it working.