CSS Full Course Day 9 [Hindi] π» | Advanced Flexbox (Align, Wrap) π | Mohit Decodes
CSS Tutorial β Day 9: Advanced Flexbox (Align & Wrap)
Welcome to Day 9 of the CSS Full Course [Hindi] by Mohit Decodes! Today weβll dive deeper into Flexbox and learn advanced properties for better alignment and wrapping.
πΉ Important Flexbox Properties for Advanced Layouts
align-content
- Controls the spacing between rows when flex items wrap to multiple lines. Works only when thereβs wrapping.
align-self
- Overrides
align-items
for individual flex items, allowing custom vertical alignment per item. flex-wrap
- Controls whether flex items should wrap to the next line or stay in a single line. Values:
nowrap
(default)wrap
wrap-reverse
flex-grow
,flex-shrink
,flex-basis
- Control how flex items grow or shrink to fill available space.
βοΈ Example CSS:
css
CopyEdit
.container {
display: flex;
flex-wrap: wrap;
align-content: space-between;
height: 300px;
background-color: #e3f2fd;
}
.item {
background-color: #2196F3;
color: white;
padding: 20px;
margin: 5px;
flex-grow: 1;
flex-basis: 150px;
align-self: center;
}
π‘ Tips:
- Use
flex-wrap: wrap;
for responsive rows of items align-content
manages spacing between multiple rowsalign-self
allows flexible control of single item alignment- Combine
flex-grow
andflex-shrink
for dynamic sizing