Skip to main content
Version: 4.0.0+Updated in 4.0.2

Flex Recipes

Flex recipes are helper recipes for quickly establishing flexbox layouts in custom CSS. These recipes are available as utility expansions in the ACSS workflow.

Layout Recipes​

?flex-row​

Establishes a horizontal flex layout:

.my-container {
?flex-row;
}

Expands to:

.my-container {
display: flex;
flex-direction: row;
}

?flex-column​

Establishes a vertical flex layout:

.my-container {
?flex-column;
}

Expands to:

.my-container {
display: flex;
flex-direction: column;
}

Centering Recipes 4.0.2+​

In Bricks and Gutenberg the centering recipes are available since ACSS 4.0.2.

These recipes provide quick centering solutions using Flexbox.

?center-all​

Centers content both horizontally and vertically:

.hero-content {
?center-all;
}

Expands to:

.hero-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
}

?center-left​

Centers content vertically, aligned to the left:

.sidebar-content {
?center-left;
}

Expands to:

.sidebar-content {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
text-align: left;
}

?center-right​

Centers content vertically, aligned to the right:

.action-buttons {
?center-right;
}

Expands to:

.action-buttons {
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: center;
text-align: right;
}

?center-top​

Centers content horizontally, aligned to the top:

.header-content {
?center-top;
}

Expands to:

.header-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
text-align: center;
}

?center-bottom​

Centers content horizontally, aligned to the bottom:

.footer-content {
?center-bottom;
}

Expands to:

.footer-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
text-align: center;
}

Grid Recipe 4.0.2+​

?flex-grid​

Creates a flexbox-based grid layout with centered unbalanced items. See Flex Grids for full documentation.

?flex-grid;

Type it on its own line in the container's CSS. It expands to a complete %root% { … } block.

Provides locally scoped variables for customization:

VariableDefaultDescription
--gapvar(--grid-gap, 1.5rem)Gap between grid items
--columns3Number of columns
--stretch0Set to 1 to stretch unbalanced items

Changes From 3.x​

In ACSS 4.0:

  • Recipe syntax changed from @ to ? prefix.
  • Flex recipes replace the removed flexbox utility classes (.flex--row, .flex--col, etc.).
  • New centering recipes added: ?center-all, ?center-left, ?center-right, ?center-top, ?center-bottom.
  • New ?flex-grid recipe replaces the deprecated flex-grid utility classes.