in 2026 with modern browsers supporting flexbox extensively across devices tabletdesktop✨
If youre new to responsive design thinking mobile first is key!
mobile-first approachits like designing for the smallest screen, making sure content looks great on tiny phones before scaling up.
But lets spice things up with a
flexible layout trick that really shines:
. container {display: flex;}. item {/'' items will grow/shrink to fill space ''/}Now heres the kicker:
Instead of fixed sizes, use percentages for initial sizing. Example?. flex-item-10pc{ width : calc(32% -.5rem); }This way you get a fluid layout that scales nicely on bigger screens without needing to add media queries everywhere.
Bonus tip: Use CSS variables
:root {--item-size-percentage:70%;}. item { width : var(--item-size-px, calc(var--item-size-percenetage)); }With this setup you can easily tweak the layout by just changing one value in your root. Perfect for quick A/B testing or adapting to different screen sizes without rewriting CSS.
Give it a try and see how much cleaner & more maintainable responsive designs become!