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

test (not verified)

test

Luca (not verified)

One of my most liked web blogs to loоk through in the morning with a mug of cappucϲino of course!

my web site; Zakir Blog

Kiran (not verified)

Nice post I have been searching for a useful post like this on salesforce course details, it is highly helpful for me and I have a great experience with this   
Salesforce Training melbourne 

MatBole (not verified)

Zpak By Mail http://buycialisuss.com - Buy Cialis Vendita Propecia Online generic 5mg cialis best price Kamagra Australia Mastrcard

Anamika Arora (not verified)
Anamika Arora (not verified)

Call Girls in Lucknow
Escorts Service in Lucknow
Escorts in Lucknow
Female Escorts in Lucknow
Russian Escorts in Lucknow
Call Girls in Pune
Escorts Service in Pune
Escorts in Pune
Female Escorts in Pune
Russian Escorts in Pune
Call Girls in Goa
Escorts Service in Goa
Escorts in Goa
Female Escorts in Goa
Russian Escorts in Goa
Call Girls in Kolkata
Escorts Service in Kolkata
Escorts in Kolkata
Female Escorts in Kolkata
Russian Escorts in Kolkata
Call Girls in Faridabad
Escorts Service in Faridabad
Escorts in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Call Girls in Lucknow

Escorts Service in Lucknow
Escorts in Lucknow
Female Escorts in Lucknow
Russian Escorts in Lucknow
Call Girls in Pune
Escorts Service in Pune
Escorts in Pune
Female Escorts in Pune
Russian Escorts in Pune
Call Girls in Goa
Escorts Service in Goa
Escorts in Goa
Female Escorts in Goa
Russian Escorts in Goa
Call Girls in Kolkata
Escorts Service in Kolkata
Escorts in Kolkata
Female Escorts in Kolkata
Russian Escorts in Kolkata
Call Girls in Faridabad
Escorts Service in Faridabad
Escorts in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Call Girls in Lucknow
Escorts Service in Lucknow

Escorts in Lucknow
Female Escorts in Lucknow
Russian Escorts in Lucknow
Call Girls in Pune
Escorts Service in Pune
Escorts in Pune
Female Escorts in Pune
Russian Escorts in Pune
Call Girls in Kolkata
Escorts Service in Kolkata
Escorts in Kolkata
Female Escorts in Kolkata
Russian Escorts in Kolkata
Call Girls in Faridabad
Escorts Service in Faridabad
Escorts in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Escorts Service in Lucknow
Call Girls in Kolkata
Escorts Service in Kolkata
Escorts in Kolkata
Female Escorts in Kolkata
Russian Escorts in Kolkata
Call Girls in Faridabad
Escorts Service in Faridabad

Escorts in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Call Girls in Faridabad
Escorts Service in Faridabad
Escorts in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Call Girls in Faridabad
Escorts Service in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Call Girls in Faridabad
Escorts Service in Faridabad
Escorts in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Call Girls in Faridabad
Escorts Service in Faridabad
Escorts in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Female Escorts in Faridabad
Russian Escorts in Faridabad
Russian Escorts in Faridabad
Russian Escorts in Faridabad

StevVise (not verified)

Tadalafil Nedir http://abuycialisb.com - Cialis Medicament Nolvadex generic cialis Buy Levitra Online

StevVise (not verified)

Tadalafil Nedir http://abuycialisb.com - Cialis Medicament Nolvadex generic cialis Buy Levitra Online

Add new comment