I posted the video on my site using iframeYouTube, and iframe- full width ( 100%), the video is very small (height) inside the frame. How do I adjust the width of the container?
iframe
100%
The code:
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/5m_ZUQTW13I" frameborder="0" allowfullscreen></iframe>
See screenshot
To make the full width of the video image and keep the height (and keep it responsive), you can use the following setting.
HTML with video
<div class="videoWrapper"> <!-- Copy & Pasted from YouTube --> <iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe> </div>
CSS
.videoWrapper { position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0; } .videoWrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
, iframe , , .
, / , , 100% . , 1920x1080, - , (vw). 100vw , , , .
iframe{ width: 100vw height: calc(100vw/1.77); }
fullscreen:
<html> <body> <iframe id="myFrame" src="http://www.youtube.com/embed/W7qWa52k-nE" frameborder="0" allowfullscreen></iframe> </body> </html>
, css:
#myFrame{ position:relative; top:0; left:0; width:100%; height:100%;