Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- video -->
<html>
  <body>
<video autoplay muted loop id="yuriVideo">
  <source src="https://yuri2908.github.io/ocean.mp4" type="video/mp4">
</video>

<div class="content">
  <h1>Background Video</h1>
  <p>Some overlay text to describe the video ...</p>
  <!-- Use a button to pause/play the video with JavaScript -->
  <button id="yuriBtn" onclick="myFunction()">Pause</button>
</div>
  </body>
  <html>
              
            
!

CSS

              
                /* Style the video: 100% width and height to cover the entire window */
#yuriVideo {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%;
  min-height: 100%;
}
body {
  font-family: Arial, Helvetica, sans-serif;
}
/* Add some content at the bottom of the video/page */
.content {
  position: fixed;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #f1f1f1;
  width: 100%;
  padding: 20px;
}

/* Style the button used to pause/play the video */
#yuriBtn {
  width: 200px;
  font-size: 18px;
  padding: 10px;
  border: none;
  background: #000;
  color: #fff;
  cursor: pointer;
}

#yuriBtn:hover {
  background: #ddd;
  color: black;
}
              
            
!

JS

              
                <script>
// Get the video
var video = document.getElementById("yuriVideo");

// Get the button
var btn = document.getElementById("yuriBtn");

// Pause and play the video, and change the button text
function myFunction() {
  if (video.paused) {
    video.play();
    btn.innerHTML = "Pause";
  } else {
    video.pause();
    btn.innerHTML = "Play";
  }
}
</script>
              
            
!
999px

Console