DevToolBox

CSS Flexbox Generator

ブラウザ内で処理

Flexboxレイアウトをビジュアルに設計。プロパティを調整してCSSコードを即座に生成。

プレビュー
1
2
3
4

生成CSS

.container {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 8px;
}

CSS Flexbox Generatorの使い方

Flexboxのプロパティをドロップダウンとスライダーで直感的に設定し、リアルタイムプレビューで レイアウトを確認できます。flex-direction、justify-content、align-items、flex-wrap、gapの 主要プロパティに対応。生成されたCSSコードをワンクリックでコピーできます。

How to Use the CSS Flexbox Generator

This visual tool helps you create CSS Flexbox layouts without memorizing property values. Adjust flex-direction, justify-content, align-items, flex-wrap, and gap using intuitive controls, and see the result instantly in the live preview. The generated CSS code is ready to copy and paste into your stylesheet. Perfect for learning Flexbox or quickly prototyping layouts. All processing is client-side.

Flexboxの軸・縮小・余白の対処 / Fixing Flexbox axes, shrinking, and spacing

図1: flex-directionを変えるとjustify-content(主軸)とalign-items(交差軸)の向きが入れ替わる
flex-directionによる主軸・交差軸の入れ替わりflex-direction:rowのコンテナでは横方向が主軸でjustify-contentが横の配置を、縦方向が交差軸でalign-itemsが縦の配置を制御するが、flex-direction:columnのコンテナでは縦方向が主軸でjustify-contentが縦の配置を、横方向が交差軸でalign-itemsが横の配置を制御するというように、2つのプロパティの役割が入れ替わることを示す図flex-direction: rowjustify-content(主軸)align-items(交差軸)flex-direction: columnjustify-content(主軸)align-items(交差軸)flex-directionを変えると、同じ2つのプロパティが制御する向きも入れ替わる
症状 / Symptom原因 / Cause対処 / Fix
justify-content と align-items を取り違える
Mixing up justify and align
justify は主軸(flex-direction の向き)、align は交差軸
justify = main axis, align = cross axis
column にすると役割が入れ替わる点に注意。本ツールのプレビューで確認
Remember they swap with column direction
子要素が潰れる
Items shrink unexpectedly
flex-shrink のデフォルトは 1(縮む)
flex-shrink defaults to 1
潰したくない要素に flex-shrink: 0 を指定
Set flex-shrink: 0 to protect items
テキストがあふれて崩れる
Text overflows the layout
flexアイテムの min-width はデフォルト auto で内容より縮めない
min-width: auto prevents shrinking below content
あふれる側に min-width: 0 を指定
Add min-width: 0
中央寄せが効かない
Centering not working
親に display: flex が無い/高さが無い
Parent lacks display:flex or height
親に display:flex + 高さを確保し、justify+align を center に
Give the parent flex context and height
margin と gap の二重余白
Double spacing with margin + gap
子のmarginとコンテナのgapが加算される
Item margins add to container gap
アイテム間隔は gap に一本化する
Standardize on gap

Flexboxの中央寄せ・整列・折返し / Flexbox Centering, Alignment, and Wrapping

/* 完全中央寄せ */
display: flex; justify-content: center; align-items: center;

/* ヘッダー(左ロゴ・右メニュー) */
display: flex; justify-content: space-between; align-items: center;

/* カードの等間隔折返し */
display: flex; flex-wrap: wrap; gap: 16px;

Flexboxの配置をブラウザで即時確認 / Checking Flexbox layouts instantly in the browser

Learning Flexbox is about immediate visual feedback. This generator renders the real CSS in a live preview right in your browser — no server, no latency, works offline. For two-dimensional layouts, try the CSS Grid Generator.

プレビューもコード生成もブラウザ内で完結します。2次元レイアウトはCSS Grid Generatorをどうぞ。 中央寄せの定番パターンと「効かない」原因はCSS中央寄せの方法まとめで解説しています。

🔒 すべての処理はブラウザ内で完結し、入力データはサーバーへ送信されません。登録不要・無料。 / All processing runs in your browser; nothing is uploaded. Free, no sign-up. プライバシーポリシー / Privacy Policy

参考資料 / References

関連ツール / Related Tools

関連ガイド / Related Guides