Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div class="container">
  <div class="text__container">
    <h1>YouTube Video Background</h1>
    <p>Using the YouTube iFrame Player API,
       <br /> Does not work on iOS :(</p>
  <div class="player__container">
    <div class="overlay"></div>
    <div id="player"></div>


$bg_image: ''

$font_family: Frutiger, "Frutiger Linotype", Univers, Calibri, "Gill Sans", "Gill Sans MT", "Myriad Pro", Myriad, "DejaVu Sans Condensed", "Liberation Sans", "Nimbus Sans L", Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif

  box-sizing: border-box

  margin: 0
  font-family: $font_family
  background-color: black
  background-image: url($bg_image)
  background-repeat: no-repeat
  background-size: cover cover
  height: 100%
  max-height: 400px
  margin: 0 auto
  margin-top: 2em
  position: relative
  overflow: hidden
  width: 80%
  border: 6px solid rgba(#eee, .4)

  position: relative
  padding-bottom: 56.25%
  height: 0
  overflow: hidden
  max-width: 100%

    height: 100%
    width: 100%
    display: block
    z-index: 1
    position: absolute
    background-color: rgba(blue, .2)
    background-repeat: repeat
    //background-image: url($bg_pattern) 
  iframe, embed, object
    position: absolute
    top: 0
    left: 0
    width: 100%
    height: 100%
    z-index: -99
    //transform: translateY(-200px)
  position: absolute
  padding: 2em
  height: 100%
  width: 100%
  z-index: 3
h1, p
  text-align: center
  color: white
  font-size: 2.2em
  font-weight: 300
  text-transform: uppercase
  width: 100%
  font-size: 1.1em
  border: 3px solid rgba(white, .1)
  background-color: rgba(white ,.1)
  width: 40%
  min-width: 360px
  padding: 1em 2em
  margin: 0 auto

var tag = document.createElement('script');
tag.src = "";

var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

var player;
function onYouTubeIframeAPIReady() {
  player = new YT.Player('player', {
    height: '390',
    width: '640',
    videoId: 'KL6jwnIln6w',
    playerVars: {
      autoplay: 1,
      autohide: 1,
      controls: 0,
      iv_load_policy: 3,
      fs: 0,
      loop: 1,
      mute: 1,
      showinfo: 0,
      modestbrangin: 1,
    events: {
      'onReady': onPlayerReady,
      'onStateChange': onPlayerReady

function onPlayerReady(event) {;
  // disable audio

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.