CSS CSS Basics The Box Model Margins

Jesse Dispoto
Jesse Dispoto
Front End Web Development Techdegree Graduate 14,537 Points

Shouldn't we set margin to "0 auto" instead of just "auto" to center an element?

I've only seen people use margin: 0 auto; to center a block level element, and never just strictly margin: auto; - is there a difference between using the 2? Wouldn't margin: 0 auto; be considered good practice vs. setting it at just auto?

1 Answer