HTML: video as website background - so it'll work
A video as the background of your website is a real eye-catcher. In this practical tip you will find instructions on how to embed a YouTube video using HTML code.
HTML: video as website background - so it'll work
The easiest way is to use a YouTube video. Use your own video from your YouTube channel or one that can be used freely:
- The video is integrated via iframe and set to the lowest level of the website by specifying a negative z-index value. Your texts and other elements remain in the foreground and are therefore still visible. With this code, the video starts automatically, but can be stopped by your visitors with a click.
- Copy this code into the head area: body {margin: 0; padding: 0;}. It must be between the and tags.
- Between and place this code:
- Now all you have to do is replace the YouTube video ID "CBPF-2rCpME" with that of the video you want.
- To find the ID, watch the corresponding video. The ID is the number and letter sequence behind the "//www.youtube.com/watch?v=" in the address bar.
In the next article, we'll show you what you can do when YouTube is down.