Friday, 28 August 2015

Responsive Youtube Embed

1) Put the code into css file


.video-container {
     position: relative;    
     padding-bottom: 56.25%;    
     padding-top: 30px
     height: 0
     overflow: hidden;
}

.video-container iframe,.video-container object,.video-container embed {    
     position: absolute;    
     top: 0;    
     left: 0;    
     width: 100%;    
     height: 100%;
}

2) Put the code into html file


<div class="video-container">
         <iframe src="http://www.youtube.com/embed/dFVxGRekRSg" frameborder="0" width="560" height="315"></iframe>
</div>



Reference - http://avexdesigns.com/responsive-youtube-embed/





No comments:

Post a Comment