Home > Article > Web Front-end > CSS style to center align div_html/css_WEB-ITnose
Code
Use margin-left:auto;margin-right:auto; to center align your div.
.style{margin-left:auto;margin-right:auto;}
The abbreviated form is:
.style{margin:0 auto;}
The number 0 means that the top and bottom margins are 0. Can be set to different values as needed.