本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2848

flexbox-patterns

できること

このスキルは、レイアウトを壊す一般的なミスがないか、flexbox の CSS をレビューします。flex でページのレイアウトを作る開発者向けです。

使う場面

  • ✓flex の行の中でテキストがはみ出したり、切れたりしているとき。
  • ✓flex の要素の間隔が不均等で、調整しにくいとき。
  • ✓項目が意図しない形で縮んだり広がったりするとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/flexbox-patterns/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/flexbox-patterns/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“レイアウトを壊している flexbox の CSS のミスがないか、確認してもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、縮みやはみ出しの問題を起こす flex の設定を探し、gap の方が良い場所で margin が使われていないかを見ます。正しい値を提案し、必要な場所では min-width の修正を提案します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Apply Flexbox best practices

Flexbox is one of the most used CSS features, but its unintuitive default values (flex-shrink:1, min-width:auto) cause layout bugs that are hard to diagnose. Understanding the flex shorthand and the min-width:0 fix prevents the most common Flexbox breakage scenarios.

Quick Reference

  • Flexbox is for one-dimensional layouts (a row OR a column)
  • Use flex: 1 1 0 (shorthand: flex:1) for equal-width items that fill space
  • Add min-width: 0 to flex children when text overflow truncation doesn't work
  • Use gap instead of margin for spacing between flex items

Check

Review this CSS for common Flexbox mistakes: missing min-width:0 on text-containing flex children, using margin instead of gap for spacing, and improper flex shorthand usage.

Fix

Fix the Flexbox layout issues: add min-width:0 where needed, replace inter-item margins with gap, and correct flex shorthand values.

Explain

Explain how flex-grow, flex-shrink, and flex-basis work, what the flex shorthand means, and why min-width:0 fixes text overflow in flex layouts.

Code Review

Review stylesheets, component styles, and responsive states related to Apply Flexbox best practices. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/flexbox-patterns

よくある質問

flex のレイアウトでテキストがはみ出すのはなぜですか?

flex の子要素には既定の最小幅があり、テキストが縮むのを妨げることがあるためです。このスキルは min-width を 0 にする修正を提案しています。

間隔には gap と margin のどちらを使うべきですか?

flex の項目の間の間隔には gap を使うことを、このスキルは推奨しています。

flex 1 とは何を意味しますか?

利用できる空間を項目で均等に分け合うことを示す、省略形だと説明しています。

詳細

作者による元の説明

Use when reviewing stylesheets, component styles, and responsive behavior related to Apply Flexbox best practices. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2848
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル