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.

              <div class="card">
  <div class="card__image"><img class="js-image" alt=""/></div>
  <div class="card__content">
    <h1 class="card__heading js-heading"></h1>
    <p class="card__paragraph js-paragraph"></p>
<div class="button-group">
  <button class="button js-toggle">Toggle content</button>
              $color--white = #FFFFFF
$color--black = #000000
$color--off-white = #E6E6E6
$color--grey = #d8d8d8
$color--image = #d7692c
$color--primary = #2AA1C0
$color--secondary = #0E647D

  box-sizing border-box

html, body
  height 100%

  display flex
  flex-direction column
  flex-wrap wrap
  justify-content center
  align-items center
  width 100%
  height 100%
  background $color--off-white
  font-family 'Source Sans Pro', sans-serif

  width 100%
  max-width 300px
  min-height 400px
  margin 10px
  background $color--white
  border-bottom 1px solid $color--grey
  box-shadow 0 1px 4px 0 rgba(0, 0, 0, 0.1)

  position relative
  width 100%
  height 0
  padding-bottom 60%
  background $color--image
  overflow hidden
    content ''
    position absolute
    width 100%
    height 100%
    background linear-gradient(90deg, rgba(0, 0, 0, 0), rgba($color--white, 15%), rgba(0, 0, 0, 0))
    transform translateX(-100%)
    animation loading 1.5s infinite

    position relative
    max-width 100%
    z-index 1

@keyframes loading
    transform translateX(100%)
  padding 20px
  margin-top 0
  margin-bottom 10px
  font-family 'Alegreya Sans', sans-serif
  font-weight 400
    width 100%
    height 35px
    background $color--grey
    margin-bottom 20px

  margin 0
  font-size 20px
  line-height 1.35
    width 90%
    height 20px
    background $color--grey
  margin 10px
  padding 15px 20px
  background $color--primary
  border 0
  color $color--white
    background $color--secondary
              const toggle = document.querySelector('.js-toggle')
    , image = document.querySelector('.js-image')
    , heading = document.querySelector('.js-heading')
    , paragraph = document.querySelector('.js-paragraph')

let content = false

toggle.addEventListener('click', function() {
  if(content === false) {
    content = true
    image.src = 'http://unsplash.it/400/400?image=564'
    heading.innerHTML = 'Some heading'
    paragraph.innerHTML = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Culpa rerum porro aut laboriosam animi.'
  } else {
    content = false
    image.src = ''
    heading.innerHTML = ''
    paragraph.innerHTML = ''
Loading ..................