I know this has been asked a thousand times in other locations but I have tried many solutions and can not get an answer. I have two divs, one called overlay and one called image_case. The overlay covers the entire page, then the image_case is suppose to be in the center of the overlay div. But the image_case doesnt have a set width becuase a new image is always placed inside of it, so i can not get the div to be centered.
<div id="overlay">
<div id="image_case">
<a href="#"><img src="uploaded_images/6a829a83a66232a390ceabf942c6e02b.png" /></a>
</div>
</div>
CSS
#overlay{
position:absolute;
position:fixed;
z-index:1;
width:100%;
height:100%;
background-color:rgba(0,0,0,.8)
}
#image_case{
position:relative;
margin:0 auto;
width: auto;
margin-top:5%;
max-height:none;
background-color:rgba(255,255,255,1);
}
The image_case just takes the width of its parent div, which is the overlay div and it makes it the width of the enitre page.