1.0.1 • Published 7 years ago

postgrid v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
7 years ago

postgrid

A fully responsive flexbox grid helper.

Installation

Install the package:

$ npm install postgrid --save

And load it in the postcss plugins list. For more information on how to install a plugin see the PostCSS docs

Example

Columns should always be wrapped inside a flex-wrapper. The following example results in:

  • A full width, one column grid. (All columns are 1/1).
  • At breakpoint $m it will have 3 even columns (All columns are 1/3).
<div :class="$style.flexWrapper">
  <div :class="$style.col">1/3</div>
  <div :class="$style.col">1/3</div>
  <div :class="$style.col">1/3</div>
</div>
.flex-wrapper {
  wrapper: 1280px;
}

.col {
  col: 1 1;

  @media ($m) {
  	col: 1 3;
  }
}

Columns

The grid comes with 12 fluid columns:

Columns

Example:

  .col {
	col: 1 4;
  }

Vertical alignment

Vertical alignment

ComposeRendersDescription
topalign-items: flex-start;Aligns columns to top
middlealign-items: center;Aligns columns to middle
bottomalign-items: flex-end;Aligns columns to bottom

These styles can only be applied to a flex-grid wrapper.

Example:

  .flex-grid {
    align: top;
  }

Horizontal alignment

Horizontal alignment

ComposeRendersDescription
leftjustify-content: flex-start;Aligns columns to left
centerjustify-content: center;Aligns columns to center
rightjustify-content: flex-end;Aligns columns to right

These styles can only be applied to a flex-grid wrapper.

Example:

  .col {
	align: right;
  }

Align self

Column specific alignment.

ComposeRendersDescription
topalign-self: flex-start;Aligns this column to top
middlealign-self: center;Aligns this column to center
bottomalign-self: flex-end;Aligns this column to bottom

These compose styles can only be applied to a column.

Example:

  .col {
    align-self: center;
  }

Align content

Aligns a flex container's lines within when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main-axis.

Note: this property has no effect when there is only one line of flex items.

Spacing

Space around

Lines evenly distributed with equal space around each line.

Example:

.flex-grid {
  space: around
}

Space between

lines evenly distributed; the first line is at the start of the container while the last one is at the end.

Example:
.flex-grid {
  space: between
}

Gutters

Using a transparent border combined with background-clip: padding-box enables you to use percentages on cols without the need to calc gutters.

Important: When using gutters be sure to compose the corresponding gutter-fix on the flex-grid wrapper:

.flex-grid {
  gutter: 20px;
}

Note: If you need a solid border around your column use an extra div inside the column.

Gutters

Push

Push columns to the right based on col width.

Push

Example:

.col {
  push: 1 4;
}
1.0.1

7 years ago

1.0.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago