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

inticleni (not verified)

slots games http://onlinecasinofbk.com/ - casino real money play casino free slots free slots games

inticleni (not verified)

slots games http://onlinecasinofbk.com/ - casino real money play casino free slots free slots games

inticleni (not verified)

http://onlinecasinofbk.com/ vegas casino slots http://onlinecasinofbk.com/ - free casino games slots for real money

Estherchera (not verified)

Clvydm wqtqud sildenafil without a doctor's prescription Buy viagra internet

inticleni (not verified)

http://onlinecasinofbk.com/ casino online slots online casino games casino slots casino bonus codes

inticleni (not verified)

http://cbdoilusd.com/ cbd oil for dogs http://cbdoilusd.com/ - buy hemp oil pure cbd oil

inticleni (not verified)

http://cbdoilusd.com/ cbd oil benefits http://cbdoilusd.com/ - cbd drops cbd oil store

Estherchera (not verified)

Zwvcsb goxcem Buy viagra without rx Drug viagra

inticleni (not verified)

hemp cbd oil http://cbdoilusd.com/ - cbd near me cbd oil store cbd near me

inticleni (not verified)

cbd vape cdb oils cbd pure best cbd oil http://cbdoilusd.com/ - cbd oil for sale

inticleni (not verified)

cbd vape cdb oils cbd pure best cbd oil http://cbdoilusd.com/ - cbd oil for sale

inticleni (not verified)

cbd vape cdb oils cbd pure best cbd oil http://cbdoilusd.com/ - cbd oil for sale

inticleni (not verified)

http://cbdoilusd.com/ cdb oils http://cbdoilusd.com/ - hemp oil for pain cbd medic

inticleni (not verified)

buy cbd http://cbdoilusd.com/ - cbd products buy hemp oil cbd oil online

inticleni (not verified)

buy hemp oil http://buycbdoil11.com/ cbd oil store best cbd oil best cbd oil

inticleni (not verified)

buy hemp oil http://buycbdoil11.com/ cbd oil store best cbd oil best cbd oil

inticleni (not verified)

buy hemp oil http://buycbdoil11.com/ cbd oil store best cbd oil best cbd oil

inticleni (not verified)

cbd store http://buycbdoil11.com/ - cdb oils hemp oil for pain cbd vape

inticleni (not verified)

cbd oil for pain http://buycbdoil11.com/ - cbd buy cbd oil online cbd near me cbd oil online

inticleni (not verified)

buy cbd oil http://buycbdoil11.com/ - cbd tinctures buy cbd cbd oil benefits hemp oil for pain

inticleni (not verified)

http://buycbdoil11.com/ buy hemp oil cbd medic cbd tinctures cbd gummies walmart

inticleni (not verified)

http://buycbdoil11.com/ buy hemp oil cbd medic cbd tinctures cbd gummies walmart

inticleni (not verified)

http://buycbdoil11.com/ cbd gummies walmart http://buycbdoil11.com/ - best cbd oil cbd oil for pain

inticleni (not verified)

cbd gummies cbd hemp cbd

inticleni (not verified)

cbd gummies cbd hemp cbd

inticleni (not verified)

cbd oil for sale cbd oil at walmart cbd store

inticleni (not verified)

hemp oil for pain cbd vape cbd vape buy cbd http://cbdoilglk.com/ - cbd for sale

inticleni (not verified)

hemp oil for pain cbd vape cbd vape buy cbd http://cbdoilglk.com/ - cbd for sale

inticleni (not verified)

hemp oil for pain cbd vape cbd vape buy cbd http://cbdoilglk.com/ - cbd for sale

inticleni (not verified)

hemp oil for pain cbd vape cbd vape buy cbd http://cbdoilglk.com/ - cbd for sale

inticleni (not verified)

cbd oil http://cbdoilglk.com/ - buy cbd oil cbd oil cbd products

inticleni (not verified)

cbd oil online http://buycbdoilwalm.com/ - medterra cbd cbd oils cbd tinctures

inticleni (not verified)

cbd oil online http://buycbdoilwalm.com/ - medterra cbd cbd oils cbd tinctures

inticleni (not verified)

http://buycbdoilwalm.com/ cbd cream http://buycbdoilwalm.com/ - hemp oil for pain cbd oil for dogs

inticleni (not verified)

http://buycbdoilwalm.com/ cbd cream http://buycbdoilwalm.com/ - hemp oil for pain cbd oil for dogs

inticleni (not verified)

http://buycbdoilwalm.com/ cbd capsules http://buycbdoilwalm.com/ - buy cbd oil online cbd online

inticleni (not verified)

http://buycbdoilwalm.com/ cbd capsules http://buycbdoilwalm.com/ - buy cbd oil online cbd online

inticleni (not verified)

http://buycbdoilwalm.com/ cbd capsules http://buycbdoilwalm.com/ - buy cbd oil online cbd online

inticleni (not verified)

cbd oil for dogs http://buycbdoilwalm.com/ - cbd oil store medterra cbd buy cbd oil cbd for dogs

inticleni (not verified)

cdb oils cbd tinctures cbd pure cbd for dogs

inticleni (not verified)

http://buycbdoilwalm.com/ cbd products cbd medic cbd vape cbd oils

inticleni (not verified)

cbd oil http://buycbdoilwalm.com/ buy cbd cbd oil online hemp cbd

inticleni (not verified)

cbd oil http://buycbdoilwalm.com/ buy cbd cbd oil online hemp cbd

inticleni (not verified)

cdb oils http://buycbdoilwalm.com/ - buy cbd cbd drops hemp oil

inticleni (not verified)

cdb oils http://buycbdoilwalm.com/ - buy cbd cbd drops hemp oil

inticleni (not verified)

cannabis oil http://buycbdoilwalm.com/ - hemp oil pure cbd oil cbd gummies

inticleni (not verified)

cbd oils http://buycbdoilwalm.com/ cbd oil store cbd medic cbd vape

inticleni (not verified)

cbd oil store cbd oil for dogs cbd oils cbd oil at walmart

inticleni (not verified)

cbd oil store cbd oil for dogs cbd oils cbd oil at walmart

enetibliole (not verified)

cbd medic buy hemp oil cbd oil

Add new comment