Vertical issues with YouTube modal window, CSS and HTML only -
i'm trying make modal window plays youtube video. final result should dynamically resize fill contents of viewport while respecting 16:9 aspect ratio. should stop expanding once has reached 720p.
i'm running these problems:
- the video not respect height of viewport if width large (overflow)
- the video not @ vertically centered
i have no idea @ how fix these. have looked hours @ many similar stack overflow questions , have not made progress. there hope?
my html:
<div id="youtube-overlay"> <div id="youtube-margin"> <div id="youtube-container"> <iframe class="youtube-hd" src="http://www.youtube.com/embed/novw62mwsqq?rel=0&autoplay=1&autohide=1&showinfo=0" frameborder="0" ></iframe> </div> </div> </div>
my css:
#youtube-overlay { background-color: rgba(0, 0, 0, .85); height: 100%; width: 100%; left: 0; top: 0; position: fixed; z-index: 999999; visibility: hidden; } #youtube-container { position: relative; max-width: 1280px; max-height: 100%; margin: 0 auto; padding-bottom: 56.25%; } #youtube-margin { margin: 10px; } .youtube-hd { position: absolute; max-height: 720px; height: 100%; width: 100%; }
try this:
<head> <style type="text/css"> .youtube-hd { width:100%; height:100%; max-height:720px; max-width:1280px; } </style> </head> <body> <table style="width: 100%; height:100%;"> <tr> <td style="text-align: center; vertical-align: middle;"> <iframe class="youtube-hd" src="http://www.youtube.com/embed/novw62mwsqq?rel=0&autoplay=1&autohide=1&showinfo=0" frameborder="0" ></iframe> </td> </tr> </table> </body>
you don't need div
structure had.
Comments
Post a Comment