NexTool
ToolsConvertersBlogAI SuitePricing
HomeCheat SheetsCSS Flexbox Cheat Sheet
developer5 sections · 29 items

CSS Flexbox Cheat Sheet

Complete CSS Flexbox reference with all container and item properties, alignment options, and common layout patterns. Essential for front-end developers.

Container Properties (Parent)

ItemValueNotes
displayflex | inline-flexEnables flex context
flex-directionrow | row-reverse | column | column-reverseMain axis direction
flex-wrapnowrap | wrap | wrap-reverseAllow items to wrap
flex-flow[direction] [wrap]Shorthand for direction + wrap
justify-contentflex-start | flex-end | center | space-between | space-around | space-evenlyMain axis alignment
align-itemsstretch | flex-start | flex-end | center | baselineCross axis alignment
align-contentstretch | flex-start | flex-end | center | space-between | space-aroundMulti-line cross axis
gap10px | 10px 20pxRow and column gap

Item Properties (Children)

ItemValueNotes
order0 (default) | integerVisual order of item
flex-grow0 (default) | numberHow much item grows
flex-shrink1 (default) | numberHow much item shrinks
flex-basisauto | length | %Default size before grow/shrink
flex[grow] [shrink] [basis]Shorthand; flex: 1 = flex: 1 1 0
align-selfauto | flex-start | flex-end | center | baseline | stretchOverride align-items

Common Centering Patterns

ItemValueNotes
Center horizontallyjustify-content: center--
Center verticallyalign-items: center--
Perfect centerjustify-content: center; align-items: centerBoth axes
Center single childmargin: auto on childWorks in flex container

Common Layout Patterns

ItemValueNotes
Equal columnsflex: 1 on each child--
Sidebar + mainsidebar: flex: 0 0 250px; main: flex: 1--
Sticky footerbody: flex column; main: flex: 1--
Holy grailheader + [nav, main, aside] + footer all in flex--
Card gridflex-wrap: wrap; children: flex: 0 0 calc(33.33% - gap)--
Space between navjustify-content: space-between on nav--

Flexbox vs Grid Decision Guide

ItemValueNotes
Use Flexbox for1-dimensional layouts (row OR column)Navigation, toolbars
Use Grid for2-dimensional layouts (rows AND columns)Page layouts, dashboards
Flexbox strengthContent-driven sizingItems size to their content
Grid strengthLayout-driven sizingItems fit the grid tracks
Combine bothGrid for page layout, Flexbox for componentsBest practice

Tip: Use landscape orientation for wider tables

Related Tools

CSS Unit Converter

Convert between px, rem, em, pt, and other CSS units

Stay Updated

Get notified about new tools, features, and exclusive deals. No spam, ever.

Browse All Cheat Sheets →
NexTool

Free online tools for developers, writers, and creators. Powered by AI.

Tools

  • Finance & Tax
  • Investment & Retirement
  • Insurance
  • Real Estate
  • Health & Fitness
  • Home & DIY
  • Developer Tools
  • AI Tools
  • All Tools

Resources

  • Blog
  • Unit Conversions
  • All Tools

Company

  • About
  • Pricing
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy

© 2026 NexTool. All rights reserved.

Fine Print Decoder™ and all AI analysis tools are proprietary technology of NexTool.

Made with care for the internet