I'm attempting to position a wide div at the center of a smaller one. Is it possible to achieve this layout?
Here is what I have so far:
HTML
<body>
<div id="full_container">
<div id="machine_mask">
<div id="machine_container">
<!---- INSERT CONTENT HERE --->
</div>
</div>
<div class="machine_footer">
<img src="sprites/base_maquina.png" alt="control panel" />
</div>
</div>
</body>
CSS
body {
margin :0;
}
div#full_container {
width: 100%;
height: 100%;
background: #805080;
}
div#machine_mask {
margin-top: 30px;
width: 100%;
display: inline-block;
height: 600px;
background: #805080;
position: relative;
overflow: hidden;
}
div#machine_container {
width: 1230px;
height: 500px;
background: #805080;
position: relative;
margin-left: auto;
margin-right: auto;
overflow: hidden;
}
Currently, the div centers when the window exceeds 1230px in width. However, I require it to be centered even on narrower windows...
Is there a way to achieve this layout? (I considered using jQuery for repositioning, but prefer a CSS solution)
Thank you for your help!