Created
June 9, 2024 16:17
-
-
Save ayush-that/955fb419b4de1ba78617a9d19eba28c7 to your computer and use it in GitHub Desktop.
an image as background and on top of it a video with some opacity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Image Background with Transparent Video</title> | |
| <style> | |
| body, html { | |
| height: 100%; | |
| margin: 0; | |
| font-family: Arial, sans-serif; | |
| } | |
| .background { | |
| position: relative; | |
| height: 100%; | |
| background-image: url('your-image.jpg'); /* Replace with your image URL */ | |
| background-size: cover; | |
| background-position: center; | |
| } | |
| .background video { | |
| position: absolute; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| width: 80%; /* Adjust the size as needed */ | |
| height: auto; /* Maintain aspect ratio */ | |
| opacity: 0.5; /* 50% opacity */ | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="background"> | |
| <video autoplay muted loop> | |
| <source src="your-video.mp4" type="video/mp4"> <!-- Replace with your video URL --> | |
| Your browser does not support the video tag. | |
| </video> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment