Heya, I have a question about div containers. I have a fixed size container around 900px by 600px. Inside this container, there are multiple smaller divs, which are arranged in absolute. Everything looks good.
But I have one problem, I’m trying to get it so that the main container (900x600) will align itself in the middle and center of the user’s screen regardless of what resolution it is. So far, I’ve got it to center just fine, but it will not align vertically. I tried using vertical-align: middle, but it does not work. Are there any suggestions?
CSS Example
#ap_w0 {
position: relative;
width:100%;
height:100%;
float: inherit;
z-index:1;
margin-left: auto;
margin-right: auto;
margin-bottom: auto;
margin-top: auto;
overflow: visible;
}
#ap_w1 {
position: absolute;
width:926px;
height:680px;
z-index:2;
background-image: url(../img/bg_w1.png);
vertical-align: middle;
margin-left: auto;
margin-right: auto;
margin-bottom: auto;
margin-top: auto;
overflow: visible;
}
Example:
<div id="ap_w0">
<div id="ap_w1">
</div>
</div>
Thanks in advance