Valdemar_check
Explore posts from serversKPCKevin Powell - Community
•Created by Valdemar_check on 12/24/2023 in #front-end
Margin auto doesn't work as I expected
Then I'm really confused over when margin auto works and when it doesn't
17 replies
KPCKevin Powell - Community
•Created by Valdemar_check on 12/24/2023 in #front-end
Margin auto doesn't work as I expected
This is counterintuitive to me right now. I thought auto margins work whenever parent has a specific width set
17 replies
KPCKevin Powell - Community
•Created by Valdemar_check on 12/24/2023 in #front-end
Margin auto doesn't work as I expected
So, I put
display: flex
on the .header-content element, but still kept auto margins, and now it works. Why margin: 0 auto
and margin-left: auto
don't work when .left and .right are inside a block
element display but work when they're inside flex
element?17 replies
KPCKevin Powell - Community
•Created by Valdemar_check on 12/24/2023 in #front-end
Margin auto doesn't work as I expected
Thanks
17 replies
KPCKevin Powell - Community
•Created by Valdemar_check on 12/24/2023 in #front-end
Margin auto doesn't work as I expected
Ah, I forgot what it does, yeah
17 replies
KPCKevin Powell - Community
•Created by Valdemar_check on 12/24/2023 in #front-end
Margin auto doesn't work as I expected
I purposefully don't want to use flex here, because I want to train my understanding of margins
17 replies
KPCKevin Powell - Community
•Created by Valdemar_check on 12/24/2023 in #front-end
Margin auto doesn't work as I expected
But they're display is inline-block, it means they're width should be fixed (IIRC). If I inspect both elements, they have exact width
17 replies
KPCKevin Powell - Community
•Created by Valdemar_check on 12/24/2023 in #front-end
Margin auto doesn't work as I expected
But I've actually set
width: max(1200px)
on the parent element (.header-content
). I don't get it17 replies