DEV Community

Discussion on: Tip #1 : Centering elements without flexbox and automatic margins

Collapse
 
okbrown profile image
Orlando Brown

Other than the modal reason, why would margin 0 auto or flexbox not work?

If it is not working would that not hint to your markup and styling being over complicated to begin with?

Tricks/Hacks are fun and but it usually hides the problem within.

Collapse
 
gablaroche profile image
Gabriel Laroche

I agree, if I can change the html to fit margin: 0 auto; or flexbox I will do it. However, I'm working on a beast of a website and a lot of content is generated via freemarker and changing the html in some of those files could create huge regressions throughout the website and as deadlines approach, you might not be able to check every knook and crany of the website. So, in my opinion, hacks are a necessary evil