introduction
customization
modules
elements
helpers
ColorsSizingSpacingTypographyFlexboxOther helpers
presets
packages

Flexbox

Use the following flexbox helpers to distribute and align items in a container. If you are new to flexbox, you can start with this awesome guide to flexbox by CSS Tricks.

Flex direction

Use the following classes to control the direction of the items of a flex container:

ClassProperty
has-direction-rowflex-direction: row;
has-direction-row-revflex-direction: row-reverse
has-direction-columnflex-direction: column;
has-direction-column-revflex-direction: column-reverse

Use has-direction-row to position flex items horizontailly (row direction):

1
2
3
<div class="is-flex has-direction-row">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Or just use has-direction-column to position flex items vertically (in a column direction):

1
2
3
<div class="is-flex has-direction-column">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Align content

Use the following classes to define the distribution of the space between and around content items along the cross axis:

ClassProperty
has-content-centeralign-content: center;
has-content-startalign-content: flex-start;
has-content-endalign-content: flex-end;
has-content-betweenalign-content: space-between;
has-content-aroundalign-content: space-around;
has-content-evenlyalign-content: space-evenly;

Use the has-content-start helper to pack items from the start of the cross axis:

1
2
3
<div class="is-flex has-content-start has-h-64 has-flex-wrap">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use has-content-end to pack items from the end end of the cross axis:

1
2
3
<div class="is-flex has-content-end has-h-64 has-flex-wrap">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use the has-content-center helper to pack items around the center of the cross axis:

1
2
3
<div class="is-flex has-content-center has-h-64 has-flex-wrap">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Align items

Use the following classes to define the alignment of the flex items along the cross axis.

ClassProperty
has-items-startalign-items: flex-start;
has-items-endalign-items: flex-end;
has-items-centeralign-items: center;
has-items-stretchalign-items: stretch;

You can use has-items-start to align flex items to the start of the cross axis:

1
2
3
<div class="is-flex has-items-start has-h-32 has-text-center">
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-w-full has-m-2 has-p-8 is-rounded has-bg-secondary">2</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use has-items-center to align flex items to the center of the cross axis:

1
2
3
<div class="is-flex has-items-center has-h-32 has-text-center">
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-w-full has-m-2 has-p-8 is-rounded has-bg-secondary">2</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use has-items-end helper to align flex items to the end of the cross axis:

1
2
3
<div class="is-flex has-items-end has-h-32 has-text-center">
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-w-full has-m-2 has-p-8 is-rounded has-bg-secondary">2</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Align self

Use the following classes to define how a single item is aligned on the cross axis:

ClassProperty
has-self-autoalign-self: auto;
has-self-startalign-self: flex-start;
has-self-endalign-self: flex-end;
has-self-centeralign-self: center;
has-self-stretchalign-self: stretch;
has-self-baselinealign-self: baseline;

Use has-self-start to align the item to the start of the cross axis:

1
2
3
<div class="is-flex has-items-end has-h-64 has-text-center">
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-secondary has-self-start">2</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use has-self-end to align the item to the end of the cross axis:

1
2
3
<div class="is-flex has-items-start has-h-64 has-text-center">
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-secondary has-self-end">2</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use has-self-center to align the item to the center of the cross axis:

1
2
3
<div class="is-flex has-items-start has-h-64 has-text-center">
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-secondary has-self-center">2</div>
    <div class="has-w-full has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Justify content

Use the following classes to define how the browser should distribute the space between and around items along the main axis:

ClassProperty
has-justify-leftjustify-content: flex-start;
has-justify-centerjustify-content: center;
has-justify-rightjustify-content: flex-end;
has-justify-betweenjustify-content: space-between;
has-justify-aroundjustify-content: space-around;
has-justify-evenlyjustify-content: space-evenly;

Use the has-justify-start helper to pack items from the start of the main axis:

1
2
3
<div class="is-flex has-justify-start has-text-center">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use the has-justify-center helper to pack items around the center of the main axis:

1
2
3
<div class="is-flex has-justify-center has-text-center">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use the has-justify-end helper to pack items from the end of the main axis:

1
2
3
<div class="is-flex has-justify-end has-text-center">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use the has-justify-between helper to distribute items evenly, and where the first item is flush with the start and the last item is flush with the end.

1
2
3
<div class="is-flex has-justify-between has-text-center">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use the has-justify-around helper to distribute items evenly, and items will have a half-size space on either end:

1
2
3
<div class="is-flex has-justify-around has-text-center">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Use the has-justify-evenly helper to distribute items evenly:

1
2
3
<div class="is-flex has-justify-evenly has-text-center">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">3</div>
</div>

Flex wrap

Use the following classes to define how items will wrap.

ClassProperty
has-flex-wrapflex-wrap: wrap;
has-flex-no-wrapflex-wrap: nowrap;

Use has-flex-no-wrap helper to prevent items from wrapping:

1
2
3
<div class="is-flex has-flex-no-wrap has-text-center">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary has-w-96">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary has-w-96">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary has-w-96">3</div>
</div>

Flex order

Use the following classes to control the order of flex items.

ClassProperty
has-order-noneorder: 0;
has-order-firstorder: -999;
has-order-lastorder: 999;
1
2
3
<div class="is-flex has-justify-between">
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary has-order-last">1</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary">2</div>
    <div class="has-m-2 has-p-4 is-rounded has-bg-primary has-order-first">3</div>
</div>

Responsive flexbox helpers

Control the flexbox properties of an element at a specific breakpoint adding a -{breakpoint} suffix to the flexbox helper class. For example, you can change the direction of the flexbox items to column only on mobile devices adding the has-direction-column-mobile class to the container element:

<div class="is-flex has-direction-column-mobile">
    . . . 
</div>

Designed and maintained with by @jmjuanes.

Code is licensed under MIT, documentation under Creative Commons Attribution 4.0.

Currently v4.3.1