Github Repo CSS Source CSS File CSS Minified File
CSS grid layout and responsive breakpoints using flexbox. Ability to change columns to rows, and vise versa, using attribute values. Mobile first responsive design, meaning it starts at the smallest viewport first and builts up.
Attribute | Value | Purpose |
---|---|---|
layout | horizontal | This is a row with child columns. This element acts as a layout container and its immediate child elements will line up horizontally. |
layout | vertical | This is a column with child rows. This element acts as a layout container and its immediate child elements will line up vertically. |
layout-padding | Applies padding (gutters) between this layout's child cells. | |
flex | This cell should flex and fill the available area within the layout container. This is the default cell's flex behavior at every viewport size. | |
flex | [integer] | A percent of the available area to take take up. |
The above attributes can also be applied only to certain viewport sizes by using
specific media query sizes. For example, layout-md
would only be
active when the medium media query is active.
Attribute | Viewport Size | General Device |
---|---|---|
layout-lg | >= 1200px | Large devices |
layout-md | >= 960px | Desktops |
layout-sm | >= 600px | Tablets |
layout | >= 0 | An attribute without a size suffix is the default and would be overridden by larger sizes. This follows the mobile first responsive design pattern, so in many cases this would be the setting for the smallest device, such as phone. |
A layout contains cells, and a layout determines if its cells should line up horizontally or vertically. In the "Layout A" example they'll always be horizonal. In the "Layout B" example they'll always be vertical. In "Layout C" it vertical when the viewport is small, and horizontal when larger.
Child cells of layout
elements can use the flex
attribute to fill
the available space.
This layout has padding, or gutters, between each cell by adding the
layout-padding
attribute. The previous examples added in their own
margins/padding manually, whereas the layout-padding attribute spaces it all out
evenly.
Cells can be given integers to represent the percentage of the available space it should take up. Note that cells which are not given a percentage still fill up the available area.
Cells can be offset from the left, but still allow the gutters to line up correctly.
This layout lets each of the header and footer tracks height be the size of their respective content, and the middle track (menu and main) flex vertically to fill the space of the entire layout. This is also an example of nested layouts, where the entire body is a vertical layout (header/content/footer), and the content row is its own layout (menu/main), and each layout has their own settings.
The body element has the layout="vertical"
attribute.
By default the middle track has the menu and main cells stacked vertically. However,
the cells line up horizontally starting at the "small" size, which is determined by the
media query.
Be default child cells in a horizontal layout will "stretch" the height of the layout.
The center
attribute will center the cell across the main axis.
For example, on a horizontal layout the center attribute will center it
vertically within the layout. On a vertical layout, the cell will be aligned
center horizontally.
The start
attribute will position the cell at the top for a
a horizontal layout, and to the left for a vertical layout.
The end
attribute will position the cell at the bottom for a
a horizontal layout, and to the right for a vertical layout.
Justify Content attributes help distribute extra free space when either all the cells on a line are inflexible, or are flexible but have reached their maximum size.
The start-justified
attribute packs up all the cells at the start line.
The end-justified
attribute packs up all the cells at the end line.
The center-justified
attribute puts all of the cells in the center.
The space-between-justified
attribute will evenly distribute
the cells, with the first cell is aligned at the start, and the last cell
aligned at the end.
The space-around-justified
attribute will evenly distribute
the cells, all with equal space between them.
Attribute | Applies |
---|---|
block | display: block |
block-sm | display: block when the small media query is active. |
block-md | display: block when the medium media query is active. |
block-lg | display: block when the large media query is active. |
inline-block | display: inline-block |
inline-block-sm | display: inline-block when the small media query is active. |
inline-block-md | display: inline-block when the medium media query is active. |
inline-block-lg | display: inline-block when the large media query is active. |
hide | display: none |
hide-sm | display: none when the small media query is active. |
hide-md | display: none when the medium media query is active. |
hide-lg | display: none when the large media query is active. |