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

Llpweack (not verified)

[url=https://60lmentop.com/]shelf life of viagra[/url] [url=https://viamengo.com/]does viagra make you last longer in bed[/url] [url=https://didoviamen.com/]viagra for men for sale[/url]

Llpweack (not verified)

[url=https://60lmentop.com/]women and viagra[/url] [url=https://viamengo.com/]normal dose of viagra[/url] [url=https://didoviamen.com/]diabetes and viagra[/url]

bluence (not verified)

attitude claus Read more fifty experiencing

Grvamaps (not verified)

[url=https://kloviagrli.com/]lovely lilith viagra falls[/url] [url=https://vigedon.com/]buy viagra online cheapest[/url] [url=https://llecialisjaw.com/]can i take two 5mg cialis at once[/url] [url=https://jwcialislrt.com/]cialis vs viagra vs levitra[/url] [url=https://jecialisbn.com/]cialis time to work[/url]

KedReest (not verified)

[url=https://qqllviagria.com/]viagra prescription cost[/url] [url=https://ssviagriia.com/]pills like viagra[/url] [url=https://canadianpharmnorx.com/]meijers pharmacy[/url] [url=https://ggviagll.com/]when did viagra come out[/url] [url=https://viagerkr.com/]viagra vs.levitra[/url] [url=https://viagriyvik.com/]viagra without ed[/url]

KedReest (not verified)

[url=https://qqllviagria.com/]viagra without a doctor prescription usa[/url] [url=https://ssviagriia.com/]buy viagra cheaply[/url] [url=https://canadianpharmnorx.com/]california state board of pharmacy[/url] [url=https://ggviagll.com/]free trial viagra[/url] [url=https://viagerkr.com/]virectin vs viagra[/url] [url=https://viagriyvik.com/]what does viagra cost[/url]

LecfReest (not verified)

[url=https://hopeviagrin.com/]viagra how long[/url] [url=https://lightvigra.com/]when is generic viagra available[/url] [url=https://xuypharmacyonline.com/]canada drug pharmacy[/url] [url=https://online21rxon.com/]skips pharmacy[/url] [url=https://happyrxpharmacy21.com/]online pharmacy school[/url] [url=https://storerxpharmcanada.com/]liberty pharmacy[/url]

Jndqweack (not verified)

[url=https://50cialmen.com/]cialis for men[/url] [url=https://aazmencial.com/]what does cialis cost[/url] [url=https://joicialviaed.com/]how much does cialis cost per pill[/url]

Fbshweack (not verified)

[url=https://thesisacloud.com/]thesis template[/url] help thesis thesis proposal format thesis writing tips

Jndqweack (not verified)

[url=https://50cialmen.com/]cialis ed[/url] [url=https://aazmencial.com/]cialis coupons[/url] [url=https://joicialviaed.com/]otc cialis 2017[/url]

Brfgmodo (not verified)

[url=https://ljcialishe.com/]cialis commercial 2016[/url] [url=https://cialisvja.com/]buying cheap cialis online[/url] [url=https://viagraonlinejc.com/]how to enhance viagra effects[/url] [url=https://viagratx.com/]viagra jelly[/url] [url=https://buycialisxz.com/]canada pharmacy cialis[/url]

Grvamaps (not verified)

[url=https://kloviagrli.com/]indian viagra[/url] [url=https://vigedon.com/]how long does it take for viagra to work[/url] [url=https://llecialisjaw.com/]cheapest cialis 20 mg[/url] [url=https://jwcialislrt.com/]mail order cialis[/url] [url=https://jecialisbn.com/]how to get maximum effect from cialis[/url]

LecfReest (not verified)

[url=https://hopeviagrin.com/]how to tell if a man is taking viagra[/url] [url=https://lightvigra.com/]how to get viagra to work[/url] [url=https://xuypharmacyonline.com/]canadian online pharmacy reviews[/url] [url=https://online21rxon.com/]walmart pharmacy technician[/url] [url=https://happyrxpharmacy21.com/]walgreens pharmacy[/url] [url=https://storerxpharmcanada.com/]pharmacy tech certification[/url]

Llpweack (not verified)

[url=https://60lmentop.com/]60lmentop.com[/url] [url=https://viamengo.com/]viamengo.com[/url] [url=https://didoviamen.com/]didoviamen.com[/url]

Llpweack (not verified)

[url=https://60lmentop.com/]60lmentop.com[/url] [url=https://viamengo.com/]viamengo.com[/url] [url=https://didoviamen.com/]didoviamen.com[/url]

KedReest (not verified)

[url=https://qqllviagria.com/]qqllviagria.com[/url] [url=https://ssviagriia.com/]ssviagriia.com[/url] [url=https://canadianpharmnorx.com/]canadianpharmnorx.com[/url] [url=https://ggviagll.com/]ggviagll.com[/url] [url=https://viagerkr.com/]viagerkr.com[/url] [url=https://viagriyvik.com/]viagriyvik.com[/url]

KedReest (not verified)

[url=https://qqllviagria.com/]qqllviagria.com[/url] [url=https://ssviagriia.com/]ssviagriia.com[/url] [url=https://canadianpharmnorx.com/]canadianpharmnorx.com[/url] [url=https://ggviagll.com/]ggviagll.com[/url] [url=https://viagerkr.com/]viagerkr.com[/url] [url=https://viagriyvik.com/]viagriyvik.com[/url]

Jndqweack (not verified)

[url=https://50cialmen.com/]50cialmen.com[/url] [url=https://aazmencial.com/]aazmencial.com[/url] [url=https://joicialviaed.com/]joicialviaed.com[/url]

LecfReest (not verified)

[url=https://hopeviagrin.com/]hopeviagrin.com[/url] [url=https://lightvigra.com/]lightvigra.com[/url] [url=https://xuypharmacyonline.com/]xuypharmacyonline.com[/url] [url=https://online21rxon.com/]online21rxon.com[/url] [url=https://happyrxpharmacy21.com/]happyrxpharmacy21.com[/url] [url=https://storerxpharmcanada.com/]storerxpharmcanada.com[/url]

AnthonyRof (not verified)

Полноценное продвижение сайтов в ТОП 10 по Москве и России от https://seo-bro.ru/ - Услуги по раскрутке сайтов в Яндекс, Google от частного SEO специалиста с кейсами!

Продвижение оплата по факту по низким ценам!

Jndqweack (not verified)

[url=https://50cialmen.com/]50cialmen.com[/url] [url=https://aazmencial.com/]aazmencial.com[/url] [url=https://joicialviaed.com/]joicialviaed.com[/url]

Add new comment