A place for programmers of all languages to come and chat, show off what they've done, and general shop talk.
Is that how you center in CSS?
Is that how you center in CSS?
How to center in CSS (Cascading Style Sheet)? Its a question that comes into the mind of lots of developers, Some people know some quite useful tricks about how to center things in CSS while others are still wondering what is a best way of dong it.
amjustsam




I do back-end development mostly, so I always forget how to do it on the rare occasions that I need to write CSS.
I always go with the first one (margin: 0 auto;), since it's the simplest to my mind.
Sure, Margin: 0 auto; is the simplest solution but remember all the other solutions exist for a reason because margin: 0 auto; doesn't work in all cases.