How to make a YouTube embed video responsive using CSS

Posted by admin on Sat, 02/10/2018 - 08:33

Quick snippet how to make a youtube embed video responsive by CSS only.

The easiest way, using viewport units (IE9+)

iframe {
    width: 100vw; 
    height: 56.25vw; /* 100/56.25 = 560/315 = 1.778 */
    background:red;  
}

CSS2 style fix using a CSS trick and wrapper with class .aspect-ratio:

    .aspect-ratio {
      position: relative;
      width: 100%;
      height: 0;
      padding-bottom: 56%; /* The height of the item will now be 56% of the width. */
    }
 
    /* Adjust the iframe so it's rendered in the outer-width and outer-height of it's parent */
    .aspect-ratio iframe {
      position: absolute;
      width: 100%;
      height: 100%;
      left: 0;
      top: 0;
    }

Check here: https://jsfiddle.net/fhde7ddd

×

Hey! Don't miss a new cool stuff!

Comments

Anonymous (not verified)

This post has several smart concepts. I actually liked the method you ready this post. A piece of writing is standard technique to verbal communication. It needed a talent to specific the thought clearly to the readers. Thanks again! I actually have some sensible work expertise with write my essay ( https://essayjaguar.com )and my words are clearly supported what I felt through such processes within the past

Anonymous (not verified)

Thank you for letting us know about this easy thing to do. I know that some people at the https://www.instagram.com/edubirdie/?hl=en site didn't know how to do this properly. After reading this detailed post, they certainly know now.

Scott (not verified)

Thanks for teaching us how to do this here. When I asked this to my writing service friends, they didn't give me any answer, and it was sad to see that. They give me answers most of the time, but here they didn't and it's sad.

Susan James (not verified)

Idealize! Exactly what I required, worked immediately. I as of late propelled a site on PHP instructional exercises yet I as of now had a YouTube channel covering comparative stuff. So I was searching for an approach to install a video at the base end of my content instructional exercises.do my homework
Anyway, a debt of gratitude is in order for posting this!

PeterRobson (not verified)

When you have included this code, copy the offer URL of the YouTube video being referred to. Explore to Blog, Landing Pages, or Website Pages. Drift over the page or post, Essay Writing Help at that point click Edit. In a rich text module, click Insert in the toolbar, at that point select Embed.

renudas (not verified)
Priya (not verified)

Renu Das Kolkata Escorts Services has gorgeous females provides Independent Escorts Service in Kolkata call girls at 100% satisfaction with VIP models. Provided Kolkata escorts at our agency are professional in nature and are eager to serve you at your place.
Kolkata Escorts
Call Girls in Kolkata
Kolkata Escorts
Gurgaon Escorts
Delhi Escorts
Delhi Escorts
Kolkata Escort
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Kolkata Escorts
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Gurgaon Escorts
Escorts in Gurgaon
Escorts Service in Gurgaon
Female Escorts in Gurgaon
Independent Escorts in Gurgaon

Kolkata Escorts
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Kolkata Escort
Kolkata Escorts
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Kolkata Escort
Kolkata Escorts
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Kolkata Escort
Kolkata Escorts
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Kolkata Escort
Kolkata Escorts
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Kolkata Escort
Kolkata Escorts
Kolkata Escorts
Gurgaon Escorts
Delhi Escorts
Call girls in Kolkata
Kolkata Escort
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Kolkata Escorts
Kolkata Escort
Gurgaon Escorts
Escorts in Gurgaon
Escorts Service in Gurgaon
Female Escorts in Gurgaon
Independent Escorts in Gurgaon
Delhi Escorts
Delhi Escorts
Escorts in Delhi
Escorts Service in Delhi
Female Escorts in Delhi
Independent Escorts in Delhi
Gurgaon Escorts
Escorts in Gurgaon
Escorts Service
Female Escorts in Gurgaon
Independent Escorts in Gurgaon
Delhi Escorts
Delhi Escorts
Call Girls in Kolkata
Escorts in Kolkata
Escorts Service in Kolkata
Female Escorts in Kolkata
Independent Escorts in Kolkata
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Rajarhat Escorts
Escorts in Rajarhat
Escorts Service in Rajarhat
Female Escorts in Rajarhat
Independent Escorts in Rajarhat
Rajarhat Escorts
Howrah Escorts
Escorts in Howrah
Escorts Service in Howrah
Female Escorts in Howrah
Independent Escorts in Howrah
Sealdah Escorts
Escorts in Sealdah
Escorts Service in Sealdah
Female Escorts in Sealdah
Independent Escorts in Sealdah
Newtown Escorts
Escorts in Newtown
Escorts Service in Newtown
Female Escorts in Newtown
Independent Escorts in Newtown
Belgachia Escorts
Escorts in Belgachia
Escorts Service in Belgachia
Female Escorts in Belgachia
Independent Escorts in Belgachia
Ultadanga Escorts
Escorts in Ultadanga
Escorts Service in Ultadanga
Female Escorts in Ultadanga
Independent Escorts in Ultadanga
Barrackpur Escorts
Escorts in Barrackpur
Escorts Service in Barrackpur
Female Escorts in Barrackpur
Independent Escorts in Barrackpur
Kalighat Escorts
Escorts in Kalighat
Escorts Service in Kalighat
Female Escorts in Kalighat
Independent Escorts in Kalighat
Sonarpur Escorts
Escorts in Sonarpur
Escorts Service in Sonarpur
Female Escorts in Sonarpur
Independent Escorts in Sonarpur
Kalyani Escorts
Escorts in Kalyani
Escorts Service in Kalyani
Female Escorts in Kalyani
Independent Escorts in Kalyani
Ballygunge Escorts
Escorts in Ballygunge
Escorts Service in Ballygunge
Female Escorts in Ballygunge
Independent Escorts in Ballygunge
Gariahat Escorts
Escorts in Gariahat
Escorts Service in Gariahat
Female Escorts in Gariahat
Independent Escorts in Gariahat
Baguiati Escorts
Escorts in Baguiati
Escorts Service in Baguiati
Female Escorts in Baguiati
Independent Escorts in Baguiati
Kaikhali Escorts
Escorts in Kaikhali
Escorts Service in Kaikhali
Female Escorts in Kaikhali
Independent Escorts in Kaikhali
Naihati Escorts
Escorts in Naihati
Escorts Service in Naihati
Female Escorts in Naihati
Independent Escorts in Naihati
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Kolkata Escorts
Delhi Escorts
Escorts in Delhi
Escorts Service in Delhi
Female Escorts in Delhi
Independent Escorts in Delhi

Kaylee (not verified)

Thanks for sharing the informative information through the article. and all the details are awesome and good in this post.
Refer: happy wheels free to play!!

John Bill (not verified)

It had been a while since I last came across such an amazing blog, but after reading this, I would rate this blog as by far the greatest and well organized. Good work.How To Extra Money

Buy Finance Ass... (not verified)

By Visiting This Site I Found Cool Stuff Here Keep It Up.
Buy Finance Assignment Help

Add new comment