Center an Element Horizontally Using the margin Property
Another positioning technique is to center a block element horizontally. One way to do this is to set itsmarginto a value of auto.
This method works for images, too. Images are inline elements by default, but can be changed to block elements when you set thedisplayproperty toblock.
Center thedivon the page by adding amarginproperty with a value ofauto.