Centering Things with CSS Auto Margin

PHOTO EMBED

Sat Jan 18 2020 20:39:59 GMT+0000 (Coordinated Universal Time)

Saved by @_fools_dev_one_ #css #layout

.box-one {
	width: 100px;
	margin: 0 auto;
}

.box-two {
	width: 100px;
	margin-left: auto;
    margin-right: auto;
}
content_copyCOPY

Both methods work as long as the width of the element is defined.

https://www.freecodecamp.org/news/how-to-center-things-with-style-in-css-dc87b7542689/