How To Embed Your Favorite YouTube Video As Your Website Background

Do you like the video backgrounds on the Bing homepage? You too can easily embed any YouTube video as your page background with a line of code.

You are probably using a single static image as the background for your website but it may offer a slightly more richer experience if you could consider placing moving images, like an animation or a self-playing video clip, in the background of your web pages.

The Bing homepage frequently uses video backgrounds, like those penguins jumping out of an ice hole one after another, and so can you on your own website.

There are several approaches here:

  • Bing uses the standard HTML5 <video> tags to serve videos on the homepage. The embedded video has a fixed size and it doesn’t resize itself with the browser.
  • There are ready-to-use jQuery plugins, Tubular and BigVideo.js for example, that let you easily use any video, or a series of videos, as page backgrounds.
  • The other more simple approach, as you can see in this demo, uses HTML and CSS tags (no JavaScript) to help you place any YouTube video in the page background.

YouTube Video Backgrounds

To get started, simply paste the code below near the opening <body> tag of your web template. You should also replace the ID with the actual video ID of the YouTube video that you would like to use in the background.

Internally, we are using YouTube’s IFRAME tags to embed that video such that it occupies the entire page (both width and height are set to 100%). Also, the z-index is set to negative so the YouTube video layer will appear several levels below the main content of your page.

The downside is that your background video won’t work on mobile devices and it is not possible to mute the sound of a video without using JavaScript.

Bonus Tip: Embed Background Music with YouTube

Remember the Geocities era when websites would automatically play background music as soon as you opened them much to the embarrassment of office workers. They mostly used raw audio files, like MP3, WAV or even the MIDI format, to embed music but you can even use any of your favorite YouTube tracks for embedding background audio.

The trick is that you embed a regular YouTube video (with autoplay=1) and set the height & width of the video player to zero so it stays invisible. This can be achieved with a single line of code which you can add anywhere on your web page.

Filed in: How To Tips, Internet Tips Tags: , , ,

You might like:

Top Technology Discussions Of The Week–13th August To 18th August Top Technology Discussions Of The Week–13th August To 18th August
Ways to Improve Your Internet Speed Ways to Improve Your Internet Speed
Bringing The Advertisers Together YouTube Will Expand Its Partner Program Bringing The Advertisers Together YouTube Will Expand Its Partner Program
How To Use Google Calculator To Convert Multiple Currencies With Latest Exchange Rate How To Use Google Calculator To Convert Multiple Currencies With Latest Exchange Rate

Leave a Reply

You must be Logged in to post comment.

© 2014 EnterWebHub. All rights reserved. XHTML / CSS Valid. XML Sitemap
.
Wordpress Themes -
Key navigation plugin by Jaspreet Chahal