What's the difference between margin:auto and justify-content / align-items center?
To center both horizontally and vertically simultaneously, there are two simple options: First .outer { display:flex; } .inner { margin:auto; } Second .outer { display: flex; justify-content: center; align-items: center; } What's the difference? In what situations would we use one over the other? In your first example... .outer { display: flex; } .inner { margin: auto; } ... the auto margin applies only to the flex item and centers that one flex item within the container. In your second example... .outer { display: flex; justify-content: center; align-items: center; } You are centering items