Skip to main content

Small CSS tricks for cleaner layouts

2025-12-01

Small CSS Tricks

Here are two small patterns I use frequently:

1. Use gap on flex containers

Instead of adding margins to children, use gap on the parent to keep spacing consistent.

2. Min-height with padding

Use min-height: calc(100vh - header-height) and add padding instead of relying on exact heights.