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

              
                link href='https://fonts.googleapis.com/css?family=League+Script|Codystar:300|Josefin+Sans:100' rel='stylesheet' type='text/css'

video autoplay='' muted='' loop=''
  source src="https://vjs.zencdn.net/v/oceans.mp4" type="video/mp4"
  source src="https://vjs.zencdn.net/v/oceans.webm" type="video/webm"

.overlay
  h1 Funky HTML5 FS video with hover overlay effect
  - for i in 0..2000
    .tile
              
            
!

CSS

              
                @import compass

html, body, .overlay
  width: 100%
  height: 100%

body
  overflow: hidden
  margin: 0
  text-align: center

// I realize how messy this is, I'm exhausted. Shoot me.
h1
  $spacesize: 60px
  $dim: $spacesize * 8
  
  position: absolute
  top: 50%
  left: 50%
  height: $dim - ($dim - $spacesize * 3) / 2
  width: $dim
  margin: -$dim / 2 0 0 #{-$dim / 2}
  padding-top: ($dim - $spacesize*3) / 2
  border: 1px dashed #afafa8
  +border-radius($dim / 2)
  font: 40px/#{$spacesize} 'Codystar', cursive
  color: #fffff8
  pointer-events: none
    
video
  height: auto
  width: 100%
  
.overlay
  position: absolute
  top: 0
  left: 0
  height: 100%
  font-size: 0
  
.tile
  opacity: 1
  width: 5%
  margin: 0
  // omfg this is BRILLIANT thank you fluidsquares.com :D :D :D
  padding-bottom: 5%
  // (using padding so that we get a % of the width, not the height)
  display: inline-block
  background: #333
  +transition(opacity .7s)
    
  &:hover
    opacity: 0
    +transition(opacity 0s)
              
            
!

JS

              
                $ () ->
  
  $window = $(window)
  $video = $('video')
  
  aspect = $video.height() / $video.width()
  
  fitVid = () ->
    h = $window.height()
    w = $window.width()
    
    if h / w > aspect
      $video.css
        'height': '120%'
        'width': 'auto'
        'margin-top': '-10%'
    else
      $video.css
        'height': 'auto'
        'width': '120%'
        'margin-left': '-10%'
  
  $window.on
    load: fitVid
    resize: fitVid
              
            
!
999px

Console