Skip to content

โš›๏ธ React Project - How to create Full screen & responsive video background in REACT - How to guide tutorial ๐Ÿ‘‰ https://frnt-end.github.io/React-Responsive-Video/

Notifications You must be signed in to change notification settings

Frnt-End/React-Responsive-Video

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Full Screen Responsive Video in React.js

Simple and fast way to make a background video in React :point_right: Watch DEMO

Start

Add your video file and import it, in this case, we added a file named 'vid-bg.mp4' inside a directory called 'video':

import BgVideo from './video/vid-bg.mp4';

Now we will embed the video using the <video> html tag:

<video autoPlay loop muted className="bg-vid"><source src={BgVideo} type="video/mp4" /> </video>

Finish

Our last step is setting the CSS style:

.bg-vid { position: fixed; width: 100%; height: 100%; object-fit: cover; z-index: 0; }

And that's it! no third party and no packages.. ๐Ÿ—ฝ

Learn More

In this little project, we customized the video to play automatically, in a loop and without sound. for further customization and more information, visit: w3-tag-video

License

Copyright ยฉ 2015 @frnt-end nirit.website

License