Skip to content
Skillpedia
Websites & UI (frontend)75k · #2848

flexbox-patterns

What it does

This skill reviews CSS flexbox code for common mistakes that break layouts. It is for developers building page layouts with flex.

When to use it

  • ✓When text overflows or gets cut off inside a flex row.
  • ✓When spacing between flex items is uneven or hard to control.
  • ✓When items shrink or grow in ways you did not intend.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/flexbox-patterns/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Can you check my flexbox CSS for mistakes that break the layout?”

5 new skills a week. 1 minute to read.

How it works

The agent looks for flex settings that cause shrinking or overflow problems, and for margins used where gap would work better. It suggests corrected values and a min-width fix where needed.

Technical content (original SKILL.md)

Original text by the author, straight from 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

FAQ

Why does text overflow in flex layouts?

Flex children have a default minimum width that can stop text from shrinking, and the skill suggests setting min-width to 0 to fix it.

Should I use gap or margin?

The skill recommends gap for spacing between flex items.

What does flex 1 mean?

The skill explains it as a shorthand for items that share the available space equally.

Details

Original description by the author

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

Popularity

GitHub stars
75k
Ranking position
#2848
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills