CSS
CSS Layout Grid Flexbox Responsive

CSS Layout Patterns - Modern Techniques

Modern CSS layout patterns using Grid, Flexbox, and advanced techniques for responsive designs.

Modern CSS layout patterns for responsive design.

Centered Container

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

Flexbox Centering

.center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

Grid Auto-Fit

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
}

Aspect Ratio

.media {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    width: 100%;
}

Responsive Typography

.heading {
    font-size: clamp(1.5rem, 4vw, 3rem);
}

Features

  • Modern CSS features
  • Responsive by default
  • Browser compatible
  • Performance optimized