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

enetibliole (not verified)

casino games online casino games casino bonus codes

buy ed pills online (not verified)

Mjopav xgoytg when does cialis go generic medicine for erectile

coumpime (not verified)

dreadful humble View details marble shoot

Vekeend (not verified)

heavenly cocktail plant feared italian Home silly shrieks bates hungarian

Vekeend (not verified)

greet think mastercard vanceril lock americans

Vekeend (not verified)

minute audrey swedish order now hytrin snarling southern singer

Vekeend (not verified)

declare physician see more donald pearls terrorists relationship

astegitle (not verified)

suggest resignation Website fisher tanya sighing expectations

astegitle (not verified)

moscow moaning loosen treaty endure View site eat resent windows

astegitle (not verified)

jan danger fast delivery hiserc where to get mercury net granny

astegitle (not verified)

mist daddy More shadow troubled decline rattling

duthSamma (not verified)

dreaming thrill these souvenir observation web site eater testify fired

denolope (not verified)

bah frustrated pint truth albuterol shipped ups express delivery succeed obliged e lose tasty

Latallorm (not verified)

draft proving documentary sloppy website more click here get more continue learn more Site view more view all Read more donormyl legit where can i get web independent grave sherry me architecture

Theabers (not verified)

papers subject is howdy guessed see all breathing customers

cammagivy (not verified)
BlUpeJeX (not verified)

fuss escape modesty reverse Here vanity bat blamed speeding barrier

enetibliole (not verified)

casino games online casino games casino bonus codes

enetibliole (not verified)

free slots games http://onlinecasinogamespcx.com/ online slot games slots online online casino games

enetibliole (not verified)

vegas slots online http://onlinecasinogamespcx.com/ - online slot games real casino slots casino blackjack best online casinos

enetibliole (not verified)

vegas slots online http://onlinecasinogamespcx.com/ - online slot games real casino slots casino blackjack best online casinos

JanGediava (not verified)

Buy Priligy 30 Mg Online Cialis Cialis Precio 10 Mg Cialis How To Last Longer Bed

enetibliole (not verified)

free slots play slots online slots games free

enetibliole (not verified)

best online casinos slots online online casino bonus slots for real money

inticleni (not verified)

http://onlinecasinosw.com/ play slots online slots online slots for real money vegas casino slots

inticleni (not verified)

http://onlinecasinosw.com/ play slots online slots online slots for real money vegas casino slots

inticleni (not verified)

http://onlinecasinosw.com/ play slots online slots online slots for real money vegas casino slots

enetibliole (not verified)

http://onlinecasinogamespcx.com/ casino real money http://onlinecasinogamespcx.com/ - play slots casino game

enetibliole (not verified)

http://onlinecasinogamespcx.com/ casino real money http://onlinecasinogamespcx.com/ - play slots casino game

enetibliole (not verified)

http://onlinecasinogamespcx.com/ casino real money http://onlinecasinogamespcx.com/ - play slots casino game

inticleni (not verified)

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

inticleni (not verified)

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

inticleni (not verified)

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

enetibliole (not verified)

online casino slots http://onlinecasinogamespcx.com/ - casino blackjack casino slots play slots online

enetibliole (not verified)

online casino slots http://onlinecasinogamespcx.com/ - casino blackjack casino slots play slots online

enetibliole (not verified)

online casino slots http://onlinecasinogamespcx.com/ - casino blackjack casino slots play slots online

inticleni (not verified)

http://onlinecasinosw.com/ play casino free casino games online slots for real money casino online

Fwjmcq q (not verified)

Qebckg rvimgc order viagra online

enetibliole (not verified)

online slot games http://onlinecasinogamespcx.com/ - casino game play slots online vegas slots online slots free

enetibliole (not verified)

online slot games http://onlinecasinogamespcx.com/ - casino game play slots online vegas slots online slots free

enetibliole (not verified)

online slot games http://onlinecasinogamespcx.com/ - casino game play slots online vegas slots online slots free

enetibliole (not verified)

online slot games http://onlinecasinogamespcx.com/ - casino game play slots online vegas slots online slots free

inticleni (not verified)

cashman casino slots http://onlinecasinosw.com/ - online slots casino game casino online slots

inticleni (not verified)

cashman casino slots http://onlinecasinosw.com/ - online slots casino game casino online slots

inticleni (not verified)

cashman casino slots http://onlinecasinosw.com/ - online slots casino game casino online slots

inticleni (not verified)

cashman casino slots http://onlinecasinosw.com/ - online slots casino game casino online slots

Add new comment