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

lasix dosing (not verified)

Resultados Propecia

abejessah (not verified)

Plaquenil

Envecehem (not verified)

Lasix

Envecehem (not verified)

furosemide davis pdf

abejessah (not verified)

Plaquenil

Graiveada (not verified)

http://buylasixshop.com/ - Lasix

Trubbebra (not verified)

https://buypriligyhop.com/ - Priligy

abejessah (not verified)

Plaquenil

abejessah (not verified)

plaquenil retinal toxicity

Ancifulty (not verified)

write my sociology paper buy a literature review paper

Envecehem (not verified)

furosemide overdose

Whasksaks (not verified)

https://buyplaquenilcv.com/ - Plaquenil

Graiveada (not verified)

https://buylasixshop.com/ - lasix generic online

Whasksaks (not verified)

http://buyplaquenilcv.com/ - Plaquenil

Graiveada (not verified)

https://buylasixshop.com/ - Lasix

Whasksaks (not verified)

http://buyplaquenilcv.com/ - order plaquenil online

Agobben (not verified)

http://buyzithromaxinf.com/ - zithromax z pack

Zithromax (not verified)

cialis c'est quoi

Agobben (not verified)

http://buyzithromaxinf.com/ - Zithromax

Whasksaks (not verified)

http://buyplaquenilcv.com/ - how long does it take for plaquenil to work

Dnrjaerop (not verified)

dissertation help umi dissertations

abejessah (not verified)

Plaquenil

Agobben (not verified)

https://buyzithromaxinf.com/ - Zithromax

Envecehem (not verified)

lasix sales

Zithromax (not verified)

Testiculos Propecia

Plaquenil (not verified)

Buy Viagra India

Agobben (not verified)

https://buyzithromaxinf.com/ - zithromax mail singapore

Plaquenil (not verified)

Cialis 20 Mg Reimport

Graiveada (not verified)

https://buylasixshop.com/ - lasix loop diuretic

dapoxetine for ... (not verified)

Que Es El Propecia

plaquenil macul... (not verified)

propiedades del viagra

zithromax costs (not verified)

Cephalexin Canine Dog

promethazine (not verified)

Online Deltasone No Prescription

Trubbebra (not verified)

https://buypriligyhop.com/ - priligy seratonin

Arerrot (not verified)

zithromax allergies

KrbcDrank (not verified)

editing thesis thesis guidelines

Trubbebra (not verified)

https://buypriligyhop.com/ - Priligy

ethipvoto (not verified)

Priligy

ethipvoto (not verified)

Priligy

Zithromax (not verified)

Cialis Viagra Yahoo Respuestas

Agobben (not verified)

http://buyzithromaxinf.com/ - allergic reaction to zithromax

Arerrot (not verified)

Zithromax

Graiveada (not verified)

http://buylasixshop.com/ - furosemide water pill

Priligy (not verified)

Cialis Deutsch

Lasix (not verified)

Amoxicillin Dose Cats

Priligy (not verified)

Canadian Pharmacy Shop

Arerrot (not verified)

can you drink on azithromycin

best site to bu... (not verified)

Mail Order Cialis Canada

Nepeazy (not verified)

http://prednisonebuyon.com/ - ordering cheap prednisone without x

urgetty (not verified)

Prednisone

Add new comment