How to add YouTube video as background using HTML

Posted by admin on Wed, 01/17/2018 - 10:46

Code snippet to add YouTube video as a background for you HTML tag.

Here goes your HTML:

<div class="video-background">
    <div class="video-foreground">
      <iframe src="https://www.youtube.com/embed/W0LHTWG-UmQ?controls=0&showinfo=0&rel=0&autoplay=1&loop=1&playlist=W0LHTWG-UmQ" frameborder="0" allowfullscreen></iframe>
    </div>
  </div>
 
<div id="vidtop-content">
<div class="vid-info">
	  <h1>YouTube background here!</h1>
  </div>
</div>

Here is your CSS (most of that just for beauty):

* { box-sizing: border-box; }
.video-background {
  background: #000;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: -99;
}
.video-foreground,
.video-background iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#vidtop-content {
	top: 0;
	color: #fff;
}
.vid-info { position: absolute; top: 0; right: 0; width: 33%; background: rgba(0,0,0,0.3); color: #fff; padding: 1rem; font-family: Avenir, Helvetica, sans-serif; }
.vid-info h1 { font-size: 2rem; font-weight: 700; margin-top: 0; line-height: 1.2; }
.vid-info a { display: block; color: #fff; text-decoration: none; background: rgba(0,0,0,0.5); transition: .6s background; border-bottom: none; margin: 1rem auto; text-align: center; }
@media (min-aspect-ratio: 16/9) {
  .video-foreground { height: 300%; top: -100%; }
}
@media (max-aspect-ratio: 16/9) {
  .video-foreground { width: 300%; left: -100%; }
}
@media all and (max-width: 600px) {
.vid-info { width: 50%; padding: .5rem; }
.vid-info h1 { margin-bottom: .2rem; }
}
@media all and (max-width: 500px) {
.vid-info .acronym { display: none; }
}
×

Hey! Don't miss a new cool stuff!

Comments

top ed pills (not verified)

Idgcfg xgzixo erectile dysfunction pills ed pills otc

inticleni (not verified)

cbd medic cbd pills cbd for dogs cbd pills http://buycbdoilonline.us.com/ - cbd for dogs

inticleni (not verified)

cbd medic cbd pills cbd for dogs cbd pills http://buycbdoilonline.us.com/ - cbd for dogs

enetibliole (not verified)

cbd capsules cbd oil online cbd for dogs buy cbd oil online

enetibliole (not verified)

cbd capsules cbd oil online cbd for dogs buy cbd oil online

inticleni (not verified)

best cbd oil cbd pure cbd store hemp cbd http://buycbdoilonline.us.com/ - pure cbd oil

inticleni (not verified)

best cbd oil cbd pure cbd store hemp cbd http://buycbdoilonline.us.com/ - pure cbd oil

inticleni (not verified)

best cbd oil cbd pure cbd store hemp cbd http://buycbdoilonline.us.com/ - pure cbd oil

inticleni (not verified)

cbd tinctures cbd vape cbd medic cbd pills

inticleni (not verified)

best cbd oil http://buycbdoilonline.us.com/ - best cbd oil cbd online cbd medic cbd oil for sale

inticleni (not verified)

best cbd oil http://buycbdoilonline.us.com/ - best cbd oil cbd online cbd medic cbd oil for sale

inticleni (not verified)

http://buycbdoilonline.us.com/ cbd products http://buycbdoilonline.us.com/ - cbd gummies cbd oil for sale

ed meds online ... (not verified)

Hnhceb xqlnij male erection pills cheap erectile dysfunction pills

medicine for im... (not verified)

Oskfpg iispdr male ed pills ed pills that really work

medicine for im... (not verified)

Oskfpg iispdr male ed pills ed pills that really work

buy ed pills online (not verified)

Vjeona xramfo erectile dysfunction pills erection pills that work

Estherchera (not verified)

Ubzthp jiepsv Buy viagra online Rx generic viagra

bisding (not verified)

Ez Pharmacy Online https://buyciallisonline.com/ - Cialis Buyrealviagraonlihenoperscription Cialis Viagra Italia Online

Estherchera (not verified)

Scdkqy nazatl canada pharmacy online canadian pharmacy

Estherchera (not verified)

Pyhxnp zfwxwu canada pharmacy pharmacy online

Estherchera (not verified)

Tbsknb smkrpr rx pharmacy canadian pharmacy online

Estherchera (not verified)

Tbsknb smkrpr rx pharmacy canadian pharmacy online

Estherchera (not verified)

Tbsknb smkrpr rx pharmacy canadian pharmacy online

Estherchera (not verified)

Brtksi cvcxwy Buy viagra Buy viagra australia

Estherchera (not verified)

Gaqmdp sgpgbj Get viagra Buy now viagra

Estherchera (not verified)

Laeqsw igwkek viagra online Viagra 100 mg

Estherchera (not verified)

Vjgpdj brfqoy viagra generic canadian pharmacy online

Estherchera (not verified)

Yzcsam sqmgjv generic cialis canada pharmacy

Estherchera (not verified)

Hkajxj gpwhzv Buy cialis online canada online pharmacy

Estherchera (not verified)

Hkajxj gpwhzv Buy cialis online canada online pharmacy

Estherchera (not verified)

Hxperg nwzxcm cialis online canadian online pharmacy

Estherchera (not verified)

Uuhzsm wmtlns Get cialis online canadian pharmacy

Estherchera (not verified)

Uuhzsm wmtlns Get cialis online canadian pharmacy

Us viagra (not verified)

Rvzixs ccvwdk vardenafil pill

Us viagra (not verified)

Rvzixs ccvwdk vardenafil pill

Buy viagra from... (not verified)

Mberfe ubrdkd vardenafil 20 mg

Canadian generi... (not verified)

Sryqkk comoyb buy levitra best over the counter ed pills

Canadian generi... (not verified)

Sryqkk comoyb buy levitra best over the counter ed pills

phefewedy (not verified)

my cialis experience https://agenericcialise.com/ - Cialis Viagra Cialis Levitra Prezzo Cialis Germany Online Pharmacy

Fda approved viagra (not verified)

Iwaqoy oeytjk kamagra online impotence pills

Fda approved viagra (not verified)

Iwaqoy oeytjk kamagra online impotence pills

Buy viagra lowe... (not verified)

Aucwst vcejur best online casino for money win real money online casino for free

Buy viagra with... (not verified)

Lruizh rlwppg vardenafil 10mg online pharmacy

Buy viagra with... (not verified)

Lruizh rlwppg vardenafil 10mg online pharmacy

Canadian pharma... (not verified)

Cuxjes mvfhbr online slots for real money online casinos usa

Canadian pharma... (not verified)

Cuxjes mvfhbr online slots for real money online casinos usa

Canadian health... (not verified)

Cdtwxn ucuxfx cialis buy online canadian pharmacy

Buy generic viagra (not verified)

Cwapat yxgedx order propecia erectile dysfunction drugs

Us viagra (not verified)

Mwiwbq dvzvnl viagra 100mg ed drugs

Female viagra (not verified)

Xcxydo mqawlx what is sildenafil ed pills for sale

Add new comment