When I was trying to code an iframe that would resize with the screen, I encountered a problem where I couldn't center it. Despite attempting all the suggestions provided in THIS thread, I still couldn't get it to work. Can someone please point out if I'm overlooking something obvious or if there's simply no way to achieve this?
Here is the HTML code:
<div class="videoWrap">
<iframe src="http://www.youtube.com/embed/playlist?list=PLn0iVeY0xhgZvWDQ1K_6EChZe_4TL5zDZ"></iframe>
</div>
And here is the corresponding CSS:
.videoWrap {
position: relative;
padding-bottom: 56.25%; /* 16:9 aspect ratio */
padding-top: 25px;
height: 0;
}
.videoWrap iframe {
position: absolute;
top: 0;
left: 0;
width: 80%;
height: 100%;
}