cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

    %h1 Hero section
    %p Resize the browser window to see the section height and content position update.

    %h2 Next section
    %h2 Third section
  font-family: Helvetica, sans-serif

body, html
  height: 100%

body, h1, h2
  margin: 0
  padding: 0

h1, h2, p
  padding: 0 40px
  background-color: #eee
  position: relative
  height: 100%
  left: 0
  max-width: 960px
  margin: 0 auto
  position: absolute
  right: 0
  top: 50%
  -webkit-transform: translateY(-50%)
  -moz-transform: translateY(-50%)
  transform: translateY(-50%)
              class browserHeightSection

  constructor: ->
    resizeSection = debounce( =>
    , 50)

    window.addEventListener "resize", resizeSection

  increaseSectionHeight: =>
    windowHeight = window.innerHeight || document.documentElement.clientHeight

    $('section').height(windowHeight).each () ->
      section = $(this).find('.inner')
      sectionTopMargin = (section.height() / 2) * -1 + 'px'
      section.css('margin-top', sectionTopMargin)

  debounce = (func, wait, immediate) ->
    timeout = undefined
      context = this
      args = arguments
      later = ->
        timeout = null
        func.apply context, args  unless immediate

      callNow = immediate and not timeout
      clearTimeout timeout
      timeout = setTimeout(later, wait)
      func.apply context, args  if callNow

$ ->
  if $('.csstransforms').length == 0
    new browserHeightSection()

Loading ..................