In order to achieve this, you need to have everything inside the wrapper div.
<style type="text/css">
#wrapper{
position:dynamic;
margin-right:auto;
margin-left:auto;
}
</style>
</head>
<body>
<div id="wrapper">
<div>
header
</div>
<div>
content
</div>
<div>
footer
</div>
</div>...