Grid system
Edit on GithubACSS does not come with an out-of-the-box grid system. Instead, you use any property you want to build grids the way you want.
Widths #
You can choose from creating a unit-base system using fractions (i.e. 1/12
), using percentages (i.e. 20%
), or using any arbitrary measurement value (i.e. 15em
). In other words, the way you apply widths onto boxes is entirely up to you.
All classes related to width
start with W
— for example: W(15em)
.
Layouts #
There are many ways to display boxes next to each other, it's up to you to decide which method fits your needs best.
inline-block
construct
#
This styling has great browser support [1] and it is direction-friendly (boxes are displayed according to ltr
/ rtl
contexts).
When creating inline-block constructs, you should use the helper class (IbBox
) instead of D(ib)
because the former gives you vertical-alignment (top
) for free.
Example #
Result
See the Pen emMPaw by Thierry (@thierry) on CodePen.
Some things to be aware of when creating inline-block
constructs:
- white-space between nodes in the markup creates space between boxes, so make sure to address this by either removing that space altogether, using html comments (
<!-- -->
), or implementing some other trick like the one used by PureCSS. vertical-align:top
is needed to make sure all boxes are top aligned (IbBox
takes care of this).
float
construct
#
This styling has great browser support and Atomizer makes it "direction" agnostic [2]. Simply use the Fl()
class (e.g., Fl(start)
or Fl(end)
).
Example
In this example, the class Cf
(for "clearfix") is used to contain the floats, but there is also a Row
helper class to better deal with floats across browsers.
Result
See the Pen PwewjM by Thierry (@thierry) on CodePen.
The exact same markup with the rtl
version of the style sheet:
See the Pen OPZPjL by Thierry (@thierry) on CodePen.
Atomizer can also auto-generate background-color
and color
.
table
and table-cell
construct
#
This styling has good browser support (IE8+) and is direction-friendly (boxes are displayed according to ltr
/ rtl
contexts).
In this example, the display
classes D(tb)
and D(tbc)
are used, along with vertical-align
and text-align
classes (Va(m)
and Ta(c)
):
Example
Result
See the Pen GgdgMa by Thierry (@thierry) on CodePen.
Tip: one can also use table-header-group
and/or table-footer-group
to swap boxes vertically without removing them from the flow:
Result
See the Pen MYGYQm by Thierry (@thierry) on CodePen.
flexbox
construct
#
D(f)
fordisplay:flex
Jc(sb)
forjustify-content:space-between
Example
Result
See the Pen Jovoem by Thierry (@thierry) on CodePen.
- Atomizer relies on
start
andend
instead ofleft
andright
which allows the usage of the same classes regardless of script context [↩].