center div horizontall code example
Example 1: how to horizontal center a div in css
#inner {
width: 50%;
margin: 0 auto;
}
Example 2: center div horizontally
/* margin auto does the magic, make sure to provide width less than 100% */
.center {
margin: auto;
width: 400px;
}
.center {
margin: auto;
width: 50%;
}