add max-width to responsive iframe - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

add max-width to responsive iframe

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
html, body {
   height:100%;
   margin:0;
}

.container {<!--   w  ww.  ja v  a2s.  c o  m-->
   height:100%;
}

.embed-responsive {
   position:relative;
   display:block;
   margin:0 auto;
   width:100%;
   max-width:921px;
   padding-bottom:57.26%;
   top:51%;
   transform:translateY(-51%)
}

.embed-responsive iframe {
   position:absolute;
   top:0;
   left:6%;
   width:91%;
   height:100%;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="embed-responsive"> 
    <iframe src="your video" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials