Flex Items

๐ŸŽจ CSS3+ ๐ŸŸข Chapter 22 of 49 ๐Ÿ“‚ Phase 08: Flexbox ๐Ÿ“… 2026 Edition
๐Ÿ“Œ Covered in this chapter: flex-grow ยท flex-shrink ยท flex-basis ยท flex shorthand ยท align-self ยท order ยท Flexible Cards ยท Equal Height ยท Centering ยท Wrapping ยท Common Mistakes ยท Debugging
Welcome to Chapter 22: Flex Items โ€” part of the CSS Complete Roadmap. This lesson covers all subtopics with clear explanations, code examples, and best practices used in professional web development.
1flex-grow, flex-shrink, flex-basis
.sidebar { flex: 0 0 240px; }    /* don't grow, don't shrink, 240px basis */
.main { flex: 1 1 auto; }       /* grow to fill remaining space */
.card { flex: 1 1 300px; }       /* flexible cards, min ~300px */

flex: 1 shorthand = flex: 1 1 0% โ€” equal distribution.

2align-self, order & Centering
CSS โ€” Perfect Center
.center-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.item-first { order: -1; }
.item-center { align-self: center; }
3Equal-Height Layouts & Common Mistakes
โš ๏ธ Common Flex Mistakes
  • align-items: center on parent โ€” children stretch avvavu, equal height lost
  • Forgetting min-width: 0 on flex children โ€” text overflow issues
  • Using margins instead of gap for spacing
  • order abuse โ€” visual order DOM order nundi different, accessibility problem
OC
Written by Our Compiler Technical Editorial Team
Reviewed for accuracy ยท CSS Complete Roadmap ยท Last updated August 2026