Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <article class="blog-post">
  <header class="js-video-hero video-hero blog-post__header">
    <h1 class="video-hero__title">Hero Title</h1>
    <img src="http://placekitten.com/500/300" alt="Video Placeholder" class="video-hero__img">
    <div class="video-hero__video embedded-video" id="video-hero__video" data-vid-id="84188053">
    </div>
    <div class="video-hero__cite">
      <div class="container">
        <a href="https://vimeo.com/84188053">DJI // SAMPLE AERIAL SHOTS</a> from <a href="https://vimeo.com/venturevisuals">Venture Visuals</a> on <a href="https://vimeo.com">Vimeo</a>.
      </div>
    </div>
  </header>
  <div class="blog-post__body">
    <div class="container">
      <p>
      Lorem ipsum dolor sit amet consectetur, adipisicing elit. Provident repudiandae quibusdam suscipit culpa voluptatum odit ipsum magnam ducimus commodi exercitationem rem sequi eaque saepe esse quia, eum temporibus unde voluptates.
    </p>
      <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptas nesciunt hic aliquid perferendis nulla, sint facere tempora iure ipsa? Consequuntur illo aspernatur, illum numquam veniam, unde dolorem voluptatum dolor accusantium, porro animi? Sed quasi asperiores architecto in culpa, iste labore illum officia, rem deleniti suscipit saepe dolor hic, harum numquam?
    </p>
    </div>
  </div>
</article>

<script src="https://player.vimeo.com/api/player.js"></script>
              
            
!

CSS

              
                /* ==========================================================================
   $Table of Contents
   ========================================================================== */
/**
 * Variables
 * Mixins
 * Functions
 * Globals
 * Grid
 */

// ==========================================================================
// $Variables
// ==========================================================================
$c-white: #fff;
$c-black: #000;
$c-gray: #ededed;
$c-peach: #fcb69f;

// Fonts
$font-sans: 'Mukta Malar', sans-serif;

$font--primary: $font-sans;

$breakpoints: (
  sm: 400px,
  md: 650px,
  lg: 900px
);

// Grid System
$grid-columns:              12 !default;
//** Padding between columns. Gets divided in half for the left and right.
$grid-gutter-width:         30px !default;

$z-layers: (
  under: -1,
  default: 1,
  layer-2: 2,
  overlay: 900
);

// ==========================================================================
// $Mixins
// ==========================================================================
@mixin mq($breakpoint) {
  // Goes to $breakpoints map and gets each $breakpoint value (if it has any)
  @if map-has-key($breakpoints, $breakpoint) {

    // Create media query based on that $breakpoint value
    @media (min-width: #{map-get($breakpoints, $breakpoint)}) {
      @content;
    }

  }
  @else {
    @warn "Breakpoint doesn't exist please check breakpoints map.";
  }
}

// Framework grid generation
//
//
// Used only by Bootstrap to generate the correct number of grid classes given
// any value of `$grid-columns`.
@mixin make-grid-columns($i: 1, $list: ".col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}") {
  @for $i from (1 + 1) through $grid-columns {
    $list: "#{$list}, .col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}";
  }
  #{$list} {
    position: relative;
    // Prevent columns from collapsing when empty
    min-height: 1px;
    // Inner gutter via padding
    padding-left:  ceil(($grid-gutter-width / 2));
    padding-right: floor(($grid-gutter-width / 2));
  }
}

@mixin float-grid-columns($class, $i: 1, $list: ".col-#{$class}-#{$i}") {
  @for $i from (1 + 1) through $grid-columns {
    $list: "#{$list}, .col-#{$class}-#{$i}";
  }
  #{$list} {
    float: left;
  }
}

@mixin calc-grid-column($index, $class, $type) {
  @if ($type == width) and ($index > 0) {
    .col-#{$class}-#{$index} {
      width: percentage(($index / $grid-columns));
    }
  }
  @if ($type == push) and ($index > 0) {
    .col-#{$class}-push-#{$index} {
      left: percentage(($index / $grid-columns));
    }
  }
  @if ($type == push) and ($index == 0) {
    .col-#{$class}-push-0 {
      left: auto;
    }
  }
  @if ($type == pull) and ($index > 0) {
    .col-#{$class}-pull-#{$index} {
      right: percentage(($index / $grid-columns));
    }
  }
  @if ($type == pull) and ($index == 0) {
    .col-#{$class}-pull-0 {
      right: auto;
    }
  }
  @if ($type == offset) {
    .col-#{$class}-offset-#{$index} {
      margin-left: percentage(($index / $grid-columns));
    }
  }
}

@mixin loop-grid-columns($columns, $class, $type) {
  @for $i from 0 through $columns {
    @include calc-grid-column($i, $class, $type);
  }
}

// Create grid for specific class
@mixin make-grid($class) {
  @include float-grid-columns($class);
  @include loop-grid-columns($grid-columns, $class, width);
  @include loop-grid-columns($grid-columns, $class, pull);
  @include loop-grid-columns($grid-columns, $class, push);
  @include loop-grid-columns($grid-columns, $class, offset);
}

// Active states
@mixin is-active {

  &:hover,
  &:focus,
  &:active,
  &.active { @content; }  

}

// Accessible Text
@mixin hide-text {
  color: transparent;
  font: 0/0 serif;
}

// ==========================================================================
// $Functions
// ==========================================================================
@function z($layer) {
  @if not map-has-key($z-layers, $layer) {
    @warn "No layer found for `#{$layer}` in $z-layers map.";
  }

  @return map-get($z-layers, $layer);
}


/* ==========================================================================
   $Globals
   ========================================================================== */
*,
*:before,
*:after {
  box-sizing: border-box;
}

html {
  background-color: rgba($c-gray, 0.25);
  box-sizing: inherit;
  font-size: 10px;
}

body {
  color: rgba($c-black, 0.8);
  font-family: $font--primary;
  font-size: 1.6rem;
  line-height: 2;
}

h1,
h2,
h3,
h4 {
  font-weight: 200;
  line-height: 1.1;
  margin: 0;
}

h1 {
  font-size: 6rem;
  line-height: 1;
}

a {
  color: inherit;
}

p {
  margin-bottom: 3rem;
}

.container {
  width: 85vw;
  max-width: 768px;
  margin-left: auto;
  margin-right: auto;
} 

.embedded-video {
  position: relative;
  z-index: z(default);
  padding-bottom: 56.25%;
}

.embedded-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}
  
  
/* ==========================================================================
   $Video Hero
   ========================================================================== */
.video-hero {
  @include mq(sm) {
    position: relative;
    z-index: z(default);
  }
}

.video-hero__img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  
  @include mq(md) {
    display: none;
  }
}

.video-hero__video,
.video-hero__cite {
  display: none;
  
  @include mq(md) {
    display: block;
  }
}

.video-hero__video {
  
  @include mq(md) {
    
    &::before {
      content: '';
      background-color: rgba($c-black, 0.65);
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: z(overlay);
    }
  }
}

.video-hero__title {
  @include mq(md) {
    color: $c-white;
    filter: drop-shadow(0 0 8px rgba($c-black, 0.9));
    position: absolute;
    z-index: z(layer-2);
    top: 40%;
    left: 0;
    right: 0;
    text-align: center;
    transform: translate(0, -40%);
  }
}

.video-hero__cite {
  font-size: 85%;
}
              
            
!

JS

              
                document.addEventListener("DOMContentLoaded", function() {
  var Player;
  var vidID = document.querySelectorAll('.video-hero__video')[0].getAttribute('data-vid-id');
  
  var videoSettings = {
    hero: document.querySelector('.js-video-hero'),
    element: document.querySelectorAll('.video-hero__video')[0],
    videoClass: 'video-hero__video',
    videoOpts: {
      // Visit: https://github.com/vimeo/player.js/
      // for all available video options.
      id: vidID,
      loop: true,
      volume: 0
    },
    isLoaded: false,
    mq: window.matchMedia('(min-width: 650px)')
  }
  
  function createVideo() {
    Player = new Vimeo.Player(videoSettings.videoClass, videoSettings.videoOpts);
    Player.setVolume(0);
    
    return Player;
  }
  
  function createAndPlayVideo() {
    createVideo();
    videoSettings.isLoaded = true;
    Player.play();
  }
  
  if (videoSettings.hero === null) {
    return;
  }
  
  // Play video on page load if media query matches.
  if (videoSettings.mq.matches) {
    createAndPlayVideo();
 }
  
  // Add an event listener to watch for browser resize.
  // Play and pause video accordingly.
  videoSettings.mq.addListener(function () {
    if (videoSettings.mq.matches && !videoSettings.isLoaded) {
      createAndPlayVideo();
    } else if (videoSettings.mq.matches && videoSettings.isLoaded) {
      Player.play();
    } else {
      Player.pause();
    }
  });
});
              
            
!
999px

Console