1 point

Centering Things with CSS Auto Margin


dashboard

Sat Jan 18 2020 20:39:59 GMT+0000 (UTC)

Posted by @_fools_dev_one_ #css #layout

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

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

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/