css - Problems with my adaptive video div -
basically trying achieve video fills div, when window size reduced of mobile resize smaller in div. however, original video way larger div need resize it. if put video 100% width effects smaller video doesn't switch when window made smaller, think need max width on video perhaps? ive tried , not altering size @ all.
my structure
im not super advanced @ html/css yet please keep basic :)
many thanks.
<div id="video_1"> <video id='myvideo'controls > <source src="video/small.mp4" type="video/mp4" media="all , (max-width: 480px), , (max-device-width: 480px)"> <source src="video/small.webm" type="video/webm" media="all , (max-width: 480px), , (max-device-width: 480px)"> <source src="video/small.ogv" type="video/ogg" media="all , (max-width: 480px), , (max-device-width: 480px)"> <source src="video/large.mp4" type="video/mp4"> <source src="video/large.webm" type="video/webm"> <source src="video/large.ogv" type="video/ogg"> fallback here </video> </div>
this piece of code keep video in proportion , scale accordingly.
sure place video inside container div.
html:
<div id="container"> <video id="video" autoplay loop> <source src="backgroundmovie.webm" type="video/webm" /> <source src="backgroundmovie.mp4" type="video/mp4" /> </video> </div>
css:
video { min-width: 100%; min-height: 100%; width: auto; height: auto; overflow: hidden; }
if want make responsive, add media query , set video's parent div width , height whatever like. make video automaticly jump 100% height/width of parent container when browser scaled.
Comments
Post a Comment