Skip to content

Instantly share code, notes, and snippets.

@profstein
Created November 28, 2024 05:40
Show Gist options
  • Save profstein/20d27d102da9d240b09076d16110a2cb to your computer and use it in GitHub Desktop.
Save profstein/20d27d102da9d240b09076d16110a2cb to your computer and use it in GitHub Desktop.
Show a video using the video element
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Element Example</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<main>
<h1>Video Element Example</h1>
<p>
Below is an example of a video element that plays a file uploaded to the web site.
</p>
<p>In this case the file names are: thelook.webm and thelook.mp4</p>
<p>In this example there is a webm and mp4 version of the video.</p>
<p>The browser will play the first version it can.</p>
<p>There is CSS applied to the element to make it responsive.</p>
<div class="video">
<video controls>
<source src="thelook.webm" type="video/webm">
<source src="thelook.mp4" type="video/mp4">
</video>
</div>
</main>
</body>
</html>
img, video{
max-width: 100%;
height: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment