Advertisement
deadhead1971

Responsive YouTube embeds

Apr 14th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. From https://themeskills.com/make-embedded-youtube-videos-responsive-wordpress/
  2.  
  3. Get the iframe embed code, and paste it within the following div.
  4.  
  5. <div class="youtube-responsive-container"><iframe ...></iframe></div>
  6.  
  7. add the following CSS to the site:
  8.  
  9. .youtube-responsive-container {
  10. position:relative;
  11. padding-bottom:56.25%;
  12. padding-top:30px;
  13. height:0;
  14. overflow:hidden;
  15. }
  16.  
  17. .youtube-responsive-container iframe, .youtube-responsive-container object, .youtube-responsive-container embed {
  18. position:absolute;
  19. top:0;
  20. left:0;
  21. width:100%;
  22. height:100%;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement