The CSS Podcast cover image

68: Why isn't the margin applying?

The CSS Podcast

00:00

Why Margin Auto Doesn't Work

Z index dev tools has CSS hints now, which are awesome and let you visually see when you might not have margin applying in certain cases. But of course, if you're doing things like, Oh, no, why am I getting all this extra margin in a flex box or a grid layout? It's not going to tell you that you've made a mistake. The easiest way to see margin auto work is to put that auto element inside of a flex container.

Play episode from 10:48
Transcript

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app