Flexbox

Use Flexbox utilities to build one-dimensional layouts with predictable direction, alignment, wrapping and flexible sizing. They are ideal for navigation bars, toolbars, button groups, media objects, card footers and compact responsive sections.

Start with is-flex or is-inline-flex, then combine direction, alignment, wrapping, gap and sizing utilities as needed.

Quick reference

ClassStylesUse case
is-flexdisplay: flex;Create a block-level Flexbox container.
is-inline-flexdisplay: inline-flex;Create an inline Flexbox container.
flex-rowflex-direction: row;Place items horizontally.
flex-colflex-direction: column;Place items vertically.
flex-wrapflex-wrap: wrap;Allow items to move onto multiple lines.
justify-content-betweenjustify-content: space-between;Distribute items across the main axis.
align-items-centeralign-items: center;Center items on the cross axis.
place-centeralign-items: center;
justify-content: center;
Center content on both axes.
flex-1flex: 1 1 0%;Create equal flexible items.
flex-noneflex: none;Prevent automatic grow and shrink behavior.

Usage

Create a Flexbox container first, then apply direction, alignment, wrapping and sizing utilities.

<div class="is-flex align-items-center justify-content-between gap-3">
  <div>Content</div>
  <button class="button is-primary">Action</button>
</div>
Content
Action

For inline elements, use is-inline-flex.

<a href="#" class="is-inline-flex align-items-center gap-1">
  <span>View docs</span>
  <span aria-hidden="true">→</span>
</a>
View docs

Direction

Use direction utilities to control the main axis of the Flexbox layout.

<!-- Row (default) -->
<div class="is-flex flex-row gap-2">
  <div>Home</div>
  <div>About</div>
  <div>Contact</div>
</div>

<!-- Column -->
<div class="is-flex flex-col gap-2">
  <div>Profile</div>
  <div>Statistics</div>
  <div>Actions</div>
</div>
Home
About
Contact
Profile
Statistics
Actions
ClassStyles
flex-rowflex-direction: row;
flex-colflex-direction: column;
flex-row-reverseflex-direction: row-reverse;
flex-col-reverseflex-direction: column-reverse;

Wrapping

Use wrapping utilities when items should stay on one line or move onto additional lines when space is limited.

<div class="is-flex flex-wrap gap-2">
  <span class="badge">Design</span>
  <span class="badge">CSS</span>
  <span class="badge">JavaScript</span>
  <span class="badge">Runtime</span>
  <span class="badge">Utilities</span>
  <span class="badge">Components</span>
</div>
DesignCSSJavaScriptRuntimeUtilitiesComponents
ClassStyles
flex-wrapflex-wrap: wrap;
flex-nowrapflex-wrap: nowrap;
wrap-reverseflex-wrap: wrap-reverse;

Main axis alignment

Use justify-content-* utilities to align or distribute items along the main axis.

<header class="is-flex align-items-center justify-content-between">
  <a href="/">Brand</a>

  <nav class="is-flex gap-3">
    <a href="/docs">Docs</a>
    <a href="/components">Components</a>
  </nav>
</header>
start
Item
Item
center
Item
Item
Item
Item
end
Brand
Docs
Components
ClassStyles
justify-content-startjustify-content: flex-start;
justify-content-endjustify-content: flex-end;
justify-content-centerjustify-content: center;
justify-content-betweenjustify-content: space-between;
justify-content-aroundjustify-content: space-around;

Cross axis alignment

Use align-items-* utilities to align items along the cross axis.

<div class="is-flex align-items-center gap-2">
  <img src="/avatar.jpg" alt="" class="thumbnail-image is-xsmall">
  <span>Profile settings</span>
</div>
start
Item A
Item B
center
Item A
Item B
end
Item A
Item B
ClassStyles
align-items-startalign-items: flex-start;
align-items-endalign-items: flex-end;
align-items-centeralign-items: center;
align-items-baselinealign-items: baseline;
align-items-stretchalign-items: stretch;

Centering content

Use place-center for the common pattern where content needs to be centered on both axes.

<div class="is-flex place-center" style="min-height: 200px;">
  <div>Centered content</div>
</div>
Centered content

Multi-line alignment

Use align-content-* utilities when a wrapping Flexbox container has multiple lines and extra cross-axis space.

<div class="is-flex flex-wrap align-content-start gap-2" style="height: 160px;">
  <div>Tag 1</div>
  <div>Tag 2</div>
  <div>Tag 3</div>
  <div>Tag 4</div>
</div>
startTag ATag BTag C
centerTag ATag BTag C
endTag ATag BTag C
ClassStyles
align-content-startalign-content: flex-start;
align-content-endalign-content: flex-end;
align-content-centeralign-content: center;
align-content-betweenalign-content: space-between;
align-content-aroundalign-content: space-around;
align-content-stretchalign-content: stretch;

Item alignment

Use align-self-* utilities to override cross-axis alignment for a single flex item.

<div class="is-flex align-items-center gap-2">
  <div>Item A</div>
  <div class="align-self-start">Item B</div>
  <div>Item C</div>
</div>
Item A
align-self-start
Item C
align-self-end
Item E
ClassStyles
align-self-autoalign-self: auto;
align-self-startalign-self: flex-start;
align-self-endalign-self: flex-end;
align-self-centeralign-self: center;
align-self-stretchalign-self: stretch;

Flexible sizing

Use sizing utilities to control how individual items grow, shrink or keep their natural size inside a flex container.

<div class="is-flex gap-3">
  <aside class="flex-none">Sidebar</aside>
  <main class="flex-1">Main content</main>
</div>
Sidebar
Main content — grows to fill remaining space
flex-1
flex-1
flex-1
ClassStylesUse case
flex-1flex: 1 1 0%;Equal-width flexible items.
flex-autoflex: 1 1 auto;Flexible item based on its natural size.
flex-noneflex: none;Keep the item from flexing automatically.
flex-shrink-0flex-shrink: 0;Prevent an item from shrinking.

Responsive flexbox

FrontAlign follows a mobile-first model. A class without a prefix applies immediately; a prefixed class applies from that breakpoint and above.

PrefixMin widthExample
sm:576pxsm:flex-row
md:768pxmd:flex-row
lg:1024pxlg:justify-content-between
xl:1280pxxl:align-items-center
<div class="is-flex flex-col md:flex-row align-items-start md:align-items-center gap-3">
  <div class="flex-1">Content</div>

  <div class="is-flex gap-2">
    <button class="button is-primary">Save</button>
    <button class="button is-light">Cancel</button>
  </div>
</div>
Content — stacks on mobile, sits beside buttons on md+
Save
Cancel

Responsive class reference

BaseSmallMediumLargeExtra large
flex-rowsm:flex-rowmd:flex-rowlg:flex-rowxl:flex-row
flex-colsm:flex-colmd:flex-collg:flex-colxl:flex-col
flex-wrapsm:flex-wrapmd:flex-wraplg:flex-wrapxl:flex-wrap
justify-content-betweensm:justify-content-betweenmd:justify-content-betweenlg:justify-content-betweenxl:justify-content-between
align-items-centersm:align-items-centermd:align-items-centerlg:align-items-centerxl:align-items-center

Common patterns

Responsive navigation

<nav class="is-flex flex-col md:flex-row align-items-center justify-content-between gap-3">
  <a href="/" class="font-bold">FrontAlign</a>

  <div class="is-flex flex-col md:flex-row gap-2">
    <a href="/docs">Docs</a>
    <a href="/components">Components</a>
    <a href="/templates">Templates</a>
  </div>
</nav>
FrontAlign
DocsComponentsTemplates

Toolbar

<div class="is-flex align-items-center justify-content-between gap-2">
  <div class="is-flex align-items-center gap-2">
    <button class="button is-light">Filter</button>
    <button class="button is-light">Sort</button>
  </div>

  <button class="button is-primary">Create</button>
</div>
FilterSort
Create

Media object

<div class="is-flex align-items-start gap-3">
  <img src="/avatar.jpg" alt="" class="thumbnail-image">

  <div>
    <h4>Runtime layer</h4>
    <p>Interactive behavior is initialized through the FrontAlign JavaScript engine.</p>
  </div>
</div>
FA
Runtime layerInteractive behavior is initialized through the FrontAlign JavaScript engine.

Split layout

<section class="is-flex flex-col lg:flex-row gap-4">
  <div class="flex-1">
    <h2>Build with utilities</h2>
    <p>Use Flexbox for component-level alignment and responsive flow.</p>
  </div>

  <div class="flex-1">
    <div class="card">Preview</div>
  </div>
</section>
Build with utilitiesUse Flexbox for component-level alignment and responsive flow.
Preview

Flexbox vs Grid

Use Flexbox when a layout flows primarily in one direction. Use Grid when rows and columns need to be controlled together.

Use Flexbox forUse Grid for
Navigation barsCard grids
ToolbarsDashboard layouts
Button groupsPricing sections
Media objectsGallery layouts
Inline actionsTwo-dimensional page sections

A common FrontAlign pattern is to use Grid for page structure and Flexbox for component structure.

Usage notes

  • Use is-flex or is-inline-flex before applying Flexbox utilities.
  • Use gap-* utilities for spacing between flex items.
  • Use flex-wrap when items should move onto multiple lines.
  • Use flex-1 for equal flexible columns.
  • Use flex-none or flex-shrink-0 when an item should keep its natural size.
  • Use place-center only on Flexbox containers.
  • Use Grid utilities when both rows and columns need to be controlled together.

FrontAlign