margin: auto is not centering
Define width
or margin
on your #sponsors
ID
as like this
#sponsors{
margin:0 auto; // left margin is auto, right margin is auto , top and bottom margin is 0 set
width:1000px; // define your width according to your design
}
More about margin auto
You must specify width to div and don't give margin twice
#sponsors {
margin:50px auto 0 auto;
margin-top:50px;
overflow: hidden;
width:160px;
background:aqua
}
DEMO
For centering DIV
you need to set css
for below.
Example
#sponsors {
margin:0px auto;
}
Comment
You also need to set width for div.
DEMO
No need of using margin: 0 auto
. Try the below code, it will work:
div#sponsors{
/* other css properties */
/* remove display:inline-block and margin: auto */
width:100%; /* instead of width: auto */
text-align: center;
}
div.img{
/*remove float:left */
/* other css properties */
display: inline-block;
}
Remove text-align: center
from body
tag and give to h1
tag instead.