black background html code with video player!!

Welcome to Techminati

Be apart of our great community, join today!

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:​

  1. Background color: The body has a black background (background-color: black), and it's centered both vertically and horizontally using flexbox.
  2. Video player: The &lt;video&gt; 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.
  3. Controls: The controls attribute adds playback controls (play, pause, volume, etc.) to the video.
To use this code:

  • Replace "video.mp4" in the &lt;source&gt; tag with the path to your video file.
 
Back
Top Bottom