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

Brand viagra ov... (not verified)

Lilgqa yiuxuh Free viagra samples Viagra mail order usa

Brand viagra ov... (not verified)

Lilgqa yiuxuh Free viagra samples Viagra mail order usa

enetibliole (not verified)

online casino real money slot games best online casinos vegas casino slots http://casinoslotsfest.com/ - real money casino

inticleni (not verified)

http://casinorealmoneyfdr.com/ online casino games http://casinorealmoneyfdr.com/ - online slots casino real money

inticleni (not verified)

http://casinorealmoneyfdr.com/ online casino games http://casinorealmoneyfdr.com/ - online slots casino real money

enetibliole (not verified)

world class casino slots http://casinoslotsfest.com/ - vegas casino slots play slots free casino games online slots

inticleni (not verified)

http://casinorealmoneyfdr.com/ free casino casino blackjack online slots play online casino

inticleni (not verified)

http://casinorealmoneyfdr.com/ free casino casino blackjack online slots play online casino

inticleni (not verified)

http://casinorealmoneyfdr.com/ free casino casino blackjack online slots play online casino

Pfizer viagra (not verified)

Raldos dnegfi Generic viagra usa Canada viagra generic

enetibliole (not verified)

gold fish casino slots http://casinoslotsfest.com/ - free casino games online casino online free casino games online big fish casino

inticleni (not verified)

big fish casino vegas slots online big fish casino slots free http://casinorealmoneyfdr.com/ - online slot games

enetibliole (not verified)

free casino games casino play free casino slot games

inticleni (not verified)

free casino http://casinorealmoneyfdr.com/ casino games casino game real money casino

enetibliole (not verified)

free slots no deposit casino vegas casino slots vegas slots online

enetibliole (not verified)

free slots no deposit casino vegas casino slots vegas slots online

enetibliole (not verified)

free slots no deposit casino vegas casino slots vegas slots online

enetibliole (not verified)

free slots no deposit casino vegas casino slots vegas slots online

Buy viagra (not verified)

Guilzl vyzscx Cialis or viagra Usa viagra sales

Buy viagra (not verified)

Guilzl vyzscx Cialis or viagra Usa viagra sales

Buy viagra (not verified)

Guilzl vyzscx Cialis or viagra Usa viagra sales

inticleni (not verified)

cashman casino slots online casino slots free casino

inticleni (not verified)

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

inticleni (not verified)

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

enetibliole (not verified)

slots free online casino slots casino game online casino bonus

inticleni (not verified)

best online casinos http://onlinecasinofbk.com/ slots for real money casino online online casino games

enetibliole (not verified)

casino play play casino play slots

enetibliole (not verified)

casino play play casino play slots

enetibliole (not verified)

casino play play casino play slots

inticleni (not verified)

http://onlinecasinofbk.com/ online casino gambling cashman casino slots best online casino casino online

enetibliole (not verified)

casino games cashman casino slots play slots play slots http://casinoslotsfest.com/ - best online casinos

inticleni (not verified)

free slots http://onlinecasinofbk.com/ - casino bonus codes slots free online slots

inticleni (not verified)

free slots http://onlinecasinofbk.com/ - casino bonus codes slots free online slots

enetibliole (not verified)

online gambling free casino games real casino slots free slots games

inticleni (not verified)

best online casinos http://onlinecasinofbk.com/ - free online slots slots for real money vegas slots online

enetibliole (not verified)

world class casino slots http://casinoslotsfest.com/ free casino games free casino games online real casino slots

inticleni (not verified)

casino play online gambling play online casino online casino

inticleni (not verified)

casino play online gambling play online casino online casino

enetibliole (not verified)

slots online http://casinoslotsfest.com/ no deposit casino free casino games online big fish casino

Overnight deliv... (not verified)

Tkxzfa rakwes Brand viagra over the net Buy viagra without rx

enetibliole (not verified)

online slot games casino online slots best online casinos real money casino

inticleni (not verified)

free slots http://onlinecasinofbk.com/ casino online slots no deposit casino online casino games

inticleni (not verified)

free slots http://onlinecasinofbk.com/ casino online slots no deposit casino online casino games

inticleni (not verified)

free slots http://onlinecasinofbk.com/ casino online slots no deposit casino online casino games

inticleni (not verified)

free slots http://onlinecasinofbk.com/ casino online slots no deposit casino online casino games

Generic viagra us (not verified)

Djrymi wxbava viagra for sale online in canada Usa pharmacy viagra

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

Add new comment