Archived topic
Why are container margins overridden by auto margins?
1 reply · Started by Phil on February 8, 2022
Hi,
I'm trying to set the left and right margins for a container to 20px but both margins are ending up as "auto" so the margin are not working.
This is the page:
http://vi.anyware.co.nz/residential-flooring-projects/
I can see this code in the generated style sheet (\wp-content\uploads\generateblocks\style-52.css):
.gb-container-c9ab9905{margin-right:20px;margin-left:20px;max-width:1200px;margin-left:auto;margin-right:auto;border-top-style: solid;border-top-width:0;}
The problem child is the "Residential Polished Concrete Floors" section.
This is the spacing for the container:
https://snipboard.io/4Vj1Ja.jpg
Why is there an extra "margin-left:auto;margin-right:auto;" in there and how do I get rid of it please?
Thanks,
Phil
Why is there an extra “margin-left:auto;margin-right:auto;” in there and how do I get rid of it please?
This is important in Flexbox to keep the contained container centered.
If there's not left/right margin auto, your site would be looking like this:
https://www.screencast.com/t/LR7dBDD8x
Can you let me know what are you trying to do?