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

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

Female viagra (not verified)

Xcxydo mqawlx what is sildenafil ed pills for sale

Order viagra us (not verified)

Emguxk kdault cheapest viagra Buy viagra canada

Cost viagra (not verified)

Hndipy bhyaii best real casino online online casino usa

phefewedy (not verified)

Para Que Sirve Levitra 10 Mg https://bbuycialisss.com/ - Buy Cialis Vendo Propecia Acquisto safe place to buy cialis online Cialis Generique Avec Dapoxetine

Buy no rx viagra (not verified)

Rmuqcy izgicf best online casino real money real casinos online no deposit

Us viagra (not verified)

Asrtqq sfjzio slot games casinos

Us viagra (not verified)

Asrtqq sfjzio slot games casinos

Buy cheap viagr... (not verified)

Ycjwxj cpuhnn cash loans online short term loans

phefewedy (not verified)

Precose https://cheapcialisll.com/ - cialis professional Generic Tab Bentyl Purchase Internet Online Free Doctor Consultation cialis dosage Donde Comprar Cialis Yahoo

Buy branded viagra (not verified)

Gkdsgv qwbiao short term loans vegas casino online

Buy branded viagra (not verified)

Gkdsgv qwbiao short term loans vegas casino online

Buy viagra lowe... (not verified)

Fhxgjf lddksg tadalafil cost cvs pharmacy

How to get viagra (not verified)

Otslfw aygtmk payday installment loans installment payday loans

Generic viagra ... (not verified)

Lsnmzy yytjma same day payday loans loans no credit check

Canadian pharma... (not verified)

Ixjrcr gvkiil loans for bad credit casino online games

Buy now viagra (not verified)

Rbdink tuomgh cash loan gambling casino online

Buy branded viagra (not verified)

Tzrfdv uzdhtf loans with bad credit payday loans for bad credit

Jerryentew (not verified)

Знаете ли вы?
Советские военные операторы на базе ленд-лизовского кинопулемёта и ППШ создали киноавтомат.
Американский лейтенант из конвоя PQ-17 был спасён советским танкером и наладил его оборону от авианалётов.
Возможно, что американцы уже в 1872 году вмешались в канадские выборы.
Английский крейсер ценой четырёх попаданий защитил конвой от немецкого рейдера.
Первая абсолютная чемпионка турнира Большого шлема похоронена в могиле для бедняков.

http://www.arbeca.net/

Jerryentew (not verified)

Знаете ли вы?
Издательство «Шиповник» было задумано для публикации сатиры, однако вместо неё печатало Лагерлёф, Бунина и Джерома Джерома.
«Голова крестьянина» хранилась в доме у немецкой актрисы.
«Бикини» для лица помогает китаянкам уберечь кожу от медуз и загара.
Бывший наркокурьер, став премьер-министром Юкона, принимал законы против наркомании и наркоторговли.
Акадийка много раз становилась первой.

arbeca

sildenafil price (not verified)

Cyyuxa gsschh amoxilin amoxicillin rash

tadalafil vs si... (not verified)

Nnrdid hohvcm lasix generic lasix