Without setting the width
, it will get the maximum width it can get. So you cannot see that the div
has centered.
#container
{
width: 50%;
height: auto;
margin: auto;
padding: 10px;
position: relative;
background-color: black; /* Just to see the different */
}