I'm trying to make a slideshow that resizes proportionally relative to the browser window size, but nothing I try seems to work. The following HTML and CSS is what I use so the slideshow stays centered on my page when the browser window is resized, but it does not yet allow for the slideshow to be resized.
How would I go about doing this? My original thought was simply to give the #parent
div a max-width
or width
of some percentage, but it doesn't work. I thought everything inside, as their widths are all set to 100%, should resize with the #parent
div, but they don't. I'm not even sure that the #parent
div is even resizing at all...
The img
is simple y a placeholder for six images I have in my actual code, but that doesn't make any difference.
#parent {
height:100%;
}
.fadein {
position:relative;
top:70px;
width:100%;
height:100%;
}
.fadein img {
position:absolute;
left:50%;
top:50%;
-webkit-transform: translate(-50%, -0%);
-moz-transform: translate(-50%, -0%);
}
#slideshow {
max-width:100%;
width:100%;
height:100%;
}
<div id="parent">
<div id="slideshow">
<div class="fadein">
<img src="http://placehold.it/350x150" />
</div>
</div>
</div>