css - Possible to make video responsive while having a max-width and max-height? -


i trying place video on page, has responsive (16:9 time). found lot of examples, same (applying 56.25% padding @ bottom). however, apply max-height , max-width iframe (because don't want fill out entire page), content underneath starts move away (because of padding).

https://jsfiddle.net/12npu2zu/

#video-container {     position: relative;     padding-bottom: 56.25%;     padding-top: 25px;     height: 0; }  iframe {     position: absolute;     top: 0;     margin: 0 auto;     left: 0;     right: 0;     width: 100%;     height: 100%;     max-width: 1000px;     max-height: 563px; } 

is there way keep doing that? maximum width 1000px , maximum height 563px (16:9).

is looking for, wrapped in 1 more div , added same style.

<div class="video-holder">   <div id="video-container">       <iframe width="1000" height="563" src="https://www.youtube.com/embed/u4ob28ksiio" frameborder="0" allowfullscreen>        </iframe>    </div>   <p>this should stay right underneath video</p> </div> 

css:

 #video-container {     position: relative;     padding-bottom: 56.25%;     padding-top: 25px;     height: 0; }  iframe {     position: absolute;     top: 0;     margin: 0 auto;     left: 0;     right: 0;     width: 100%;     height: 100%;     max-width: 1000px;     max-height: 563px; } .video-holder{     display: inline-block;     width: 100%;     height: 100%;     max-width: 1000px;     max-height: 563px; } 

https://jsfiddle.net/326w5jqj/


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -