Fullscreen Background Video is a modern way to present your website in front of your user when user view your website a video is playing in the background of your website without disturbing its content and
that makes your website very modern and different.
So, in this tutorial we will show you how to add fullscreen background video using HTML5 and CSS.You may also like custom video player using HTML5.
CHECK OUT THIS TUTORIAL LIVE DEMO →
To Add Fullscreen Background Video It Takes Only Two Steps:-
- Make a HTML file and define markup
- Make a CSS file and define styling
Step 1. Make a HTML file and define markup
We make a HTML file and save it with a name video.html
<html> <head> <link rel="stylesheet" type="text/css" href="video_style.css"> </head> <body> <div id="video_wrapper"> <video autoplay muted loop> <source src="sample.mp4" type="video/mp4"> </video> <div id="wrapper"> <h1>FullScreen Background Video Using jQuery And CSS</h1> </div> </div> </body> </html>
In this step we create video element and insert our background video and we also add some attributes required for the working of background video.
'autoplay' is used to autoplay the video on page load, muted is used to mute the video sound and loop is used to replay the video after the completion.You may also like animated background using CSS3.
Step 2. Make a CSS file and define styling
We make a CSS file and save it with a name video_style.css
body { text-align:center; width:100%; margin:0 auto; padding:0px; font-family:helvetica; } #video_wrapper { margin:0px; padding:0px; } #video_wrapper video { position: fixed; top: 50%; left: 50%; z-index: 1; min-width: 100%; min-height: 100%; width: auto; height: auto; transform: translate(-50%, -50%); } #wrapper { position:relative; text-align:center; margin:0 auto; padding:0px; width:995px; z-index:2; } h1 { margin-top:250px; color:white; font-size:45px; background-color: rgba(112, 112, 112, 0.74); }
Thats all, this is how to add fullscreen background video using HTML5 and CSS. You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.
Latest Tutorials
- Create Animated Skill Bar Using jQuery, HTML And CSS
- Simple And Best Responsive Web Design Using CSS Part 2
- Show Button On Hover Using HTML And CSS
- Material Design Login Form Using jQuery And CSS
- Animated Progress Bar Using jQuery And CSS
- Dynamic Drop Down Menu Using jQuery, Ajax, PHP And MySQL
- Get Website Statistics Using PHP, jQuery And MySQL
- HTML5 Login And Signup Form With Animation Using jQuery
- Facebook Style Homepage Design Using HTML And CSS
- View Webpage In Fullscreen Using jQuery