(I know this is an old thread, but I hope my answer helps someone there.)
Actually, you already had the right decision. style="width:100%, height:100%" on your <video> works, except that instead of a semicolon you need a semicolon. (You can remove the redundant attributes width="100%" and video="100%" .)
The reason width: 100%; height: 100% works width: 100%; height: 100% width: 100%; height: 100% (note the semicolon), although the <video> element is stretched, the video itself retains its aspect ratio and has a mailbox / columns inside the <video> element: fooobar.com/questions/ 319284 / ....
The advantage of height: 100% is that the video is placed in the mailbox exactly in the center, while with max-height: 100% video is aligned at the top of the container.
In addition, you must set <video> to display: block . Otherwise, by default it will be display: inline and you will get some space at the bottom of the video for the font descenders: There is a 4px space below the canvas / video / audio elements in HTML5 .
Finally, like @ gilly3, you'll need a semicolon after background-color: #000 . And of course you need to remove display: none . =)
Here's the complete solution:
#player-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; z-index: 999; } video { display: block; width: 100%; height: 100%; }
<div id="player-overlay"> <video controls> <source src="http://techslides.com/demos/sample-videos/small.webm" type="video/webm"> <source src="http://techslides.com/demos/sample-videos/small.ogv" type="video/ogg"> <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4"> <source src="http://techslides.com/demos/sample-videos/small.3gp" type="video/3gp"> </video> </div>
Run the code snippet in full page mode and resize the browser window to see the effect of the mailbox.
By the way, your video sources didn’t work anymore, so I used video samples:
http://techslides.com/sample-webm-ogg-and-mp4-video-files-for-html5 .
Hope this helps.
source share