CSS3
Flexbox Layout
Align and distribute items along one axis with flexbox.
By EZ4Code Team
flexboxlayout
Code
.container {
display: flex;
flex-direction: row; /* row | column | row-reverse */
justify-content: space-between; /* main-axis alignment */
align-items: center; /* cross-axis alignment */
flex-wrap: wrap;
gap: 16px;
}
.item {
flex: 1 1 200px; /* grow shrink basis */
order: 2;
align-self: flex-end;
}
/* Center anything with three lines */
.center {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}Explanation
Flexbox lays out items along a single axis controlled by flex-direction. justify-content aligns on the main axis, align-items on the cross axis, and the flex shorthand sets grow, shrink, and basis. It is the standard tool for one-dimensional layouts and centering.
More CSS3 Snippets
Grid Layout
Build two-dimensional layouts with grid-template-areas.
Animations
Define keyframes and apply reusable animations.
Transitions
Smoothly interpolate properties on state change.
2D & 3D Transforms
Translate, rotate, and scale elements with GPU-friendly transforms.
Media Queries
Apply responsive, print, and preference-based styles.
Custom Properties
Define and reuse CSS variables with live updates.