Flexbox Cheat Sheet

CSS Flexbox properties reference guide

Flexbox Cheat Sheet

Quick reference guide for CSS Flexbox properties. Click the copy button to copy any command.

70
Total Commands
70
Filtered Results

Container Properties

CommandCopyDescription
display: flexEnable flexbox layout
display: inline-flexInline flex container

Flex Direction

CommandCopyDescription
flex-direction: rowHorizontal left to right (default)
flex-direction: row-reverseHorizontal right to left
flex-direction: columnVertical top to bottom
flex-direction: column-reverseVertical bottom to top

Flex Wrap

CommandCopyDescription
flex-wrap: nowrapSingle line (default)
flex-wrap: wrapMulti-line, top to bottom
flex-wrap: wrap-reverseMulti-line, bottom to top

Flex Flow (Shorthand)

CommandCopyDescription
flex-flow: row nowrapDirection and wrap combined
flex-flow: column wrapColumn direction with wrap

Justify Content (Main Axis)

CommandCopyDescription
justify-content: flex-startAlign items to start (default)
justify-content: flex-endAlign items to end
justify-content: centerCenter items
justify-content: space-betweenSpace between items
justify-content: space-aroundSpace around items
justify-content: space-evenlyEven space between items

Align Items (Cross Axis)

CommandCopyDescription
align-items: stretchStretch to fill container (default)
align-items: flex-startAlign to cross-axis start
align-items: flex-endAlign to cross-axis end
align-items: centerCenter on cross-axis
align-items: baselineAlign to text baseline

Align Content (Multiple Lines)

CommandCopyDescription
align-content: stretchStretch lines (default)
align-content: flex-startPack lines to start
align-content: flex-endPack lines to end
align-content: centerCenter lines
align-content: space-betweenSpace between lines
align-content: space-aroundSpace around lines
align-content: space-evenlyEven space between lines

Gap

CommandCopyDescription
gap: 10pxSpace between items (both axes)
row-gap: 10pxSpace between rows
column-gap: 10pxSpace between columns
gap: 10px 20pxRow gap 10px, column gap 20px

Item Properties - Order

CommandCopyDescription
order: 0Display order (default 0)
order: 1Display after order 0
order: -1Display before order 0

Item Properties - Flex Grow

CommandCopyDescription
flex-grow: 0Do not grow (default)
flex-grow: 1Grow to fill space equally
flex-grow: 2Grow twice as much as flex-grow: 1

Item Properties - Flex Shrink

CommandCopyDescription
flex-shrink: 1Allow shrinking (default)
flex-shrink: 0Do not shrink
flex-shrink: 2Shrink twice as much

Item Properties - Flex Basis

CommandCopyDescription
flex-basis: autoBased on content size (default)
flex-basis: 200pxInitial size before grow/shrink
flex-basis: 50%Percentage of container
flex-basis: 0Ignore content size

Item Properties - Flex Shorthand

CommandCopyDescription
flex: 0 1 autoDefault (grow shrink basis)
flex: 1Shorthand for flex: 1 1 0
flex: autoShorthand for flex: 1 1 auto
flex: noneShorthand for flex: 0 0 auto
flex: 2Grow twice as much as flex: 1

Item Properties - Align Self

CommandCopyDescription
align-self: autoUse container align-items (default)
align-self: flex-startAlign to cross-axis start
align-self: flex-endAlign to cross-axis end
align-self: centerCenter on cross-axis
align-self: baselineAlign to baseline
align-self: stretchStretch to fill

Common Patterns

CommandCopyDescription
display: flex; justify-content: center; align-items: center;Perfect centering
display: flex; justify-content: space-between;Space items apart
display: flex; flex-direction: column;Vertical layout
display: flex; flex-wrap: wrap;Responsive wrapping
display: flex; flex: 1;Equal width items
display: flex; align-items: baseline;Align text baselines

Advanced Patterns

CommandCopyDescription
margin-left: autoPush item to the right
margin-right: autoPush item to the left
margin: autoCenter item (with flex)

Responsive Flexbox

CommandCopyDescription
@media (max-width: 768px) { flex-direction: column; }Stack on mobile
@media (max-width: 768px) { flex-wrap: wrap; }Wrap on mobile

Browser Prefixes (Legacy)

CommandCopyDescription
display: -webkit-flexWebkit prefix for old browsers
display: -ms-flexboxIE 10 prefix

All operations are performed locally in your browser. No data is sent to any server.

About Flexbox Cheat Sheet

This section will contain detailed, SEO-friendly content about the Flexbox Cheat Sheet.

In the future, this content will be managed through a headless CMS, allowing you to:

  • Add detailed explanations about how to use this tool
  • Include examples and use cases
  • Provide tips and best practices
  • Add FAQs and troubleshooting guides
  • Update content without touching the code

How to Use

Step-by-step instructions for using the Flexbox Cheat Sheet will appear here. This content will be fully customizable through the admin panel.

Features

Key features and benefits of this tool will be listed here. All content is editable via the CMS.