G
gukesh
Guest
simple HTML code that creates a web page with a black background and a video player:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Player with Black Background</title>
<style>
/* Style to make the background black */
body {
background-color: black;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
/* Video player styling */
video {
width: 80%;
max-width: 800px;
border: 2px solid #fff;
border-radius: 10px;
}
</style>
</head>
<body>
<!-- Video player -->
<video controls>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
Explanation:
- Background color: The body has a black background (background-color: black), and it's centered both vertically and horizontally using flexbox.
- Video player: The <video> element is styled to take up 80% of the width of the viewport, with a max width of 800px. It has a white border and slightly rounded corners.
- Controls: The controls attribute adds playback controls (play, pause, volume, etc.) to the video.
- Replace "video.mp4" in the <source> tag with the path to your video file.