Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                .container
  label(for='let-the-dogs-out') Let the dogs out?
  input.let-the-dogs-out(type='checkbox', id='let-the-dogs-out')
  label.no-firefox Unfortunately, not in this browser 😭<br/> Maybe try Firefox to set them free!

  .dogmoji 🐶
  .yard
    .kennel
      .kennel__front
        .kennel__frame
          .kennel__door
            .dogs
              .dog 🐶
              .dog 🐶
              .dog 🐶
        .kennel__roof.kennel__roof--left
        .kennel__roof.kennel__roof--right
      - for(let i = 0; i < 15; i++)
        - let doge = Math.random() > 0.5 ? '🐕' : '🐩'
        .dog= doge


              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Lato')
*
  box-sizing border-box

body
  background-color #2eec71
  color            #fafafa
  text-align       center
  font-size        16px
  font-family      'Lato', sans-serif
  padding          2rem

random(ceiling)
  return floor(math(1, 'random')*ceiling)

limit = 40
@keyframes move
  0%, 100%
    transform translate(0, 0)
  25%
    transform translate((random(limit) - (limit / 2)) * 1%, (random(limit) - (limit / 2)) * 1%)
  50%
    transform translate((random(limit) - (limit / 2)) * 1%, (random(limit) - (limit / 2)) * 1%)
  75%
    transform translate((random(limit) - (limit / 2)) * 1%, (random(limit) - (limit / 2)) * 1%)

@keyframes move-flipped
  0%, 100%
    transform rotateY(180deg) translate(0, 0)
  25%
    transform rotateY(180deg) translate((random(limit) - (limit / 2)) * 1%, (random(limit) - (limit / 2)) * 1%)
  50%
    transform rotateY(180deg) translate((random(limit) - (limit / 2)) * 1%, (random(limit) - (limit / 2)) * 1%)
  75%
    transform rotateY(180deg) translate((random(limit) - (limit / 2)) * 1%, (random(limit) - (limit / 2)) * 1%)

@keyframes nod
  0, 100%
    transform translateY(0)
  50%
    transform translateY(25%)

@keyframes get-excited
  0, 100%
    transform translateY(0)
  50%
    transform translateY(-15px)

.container
  align-items center
  flex-direction column
  position relative
  text-align center

label
  font-size 2rem
  text-decoration line-through

.dogmoji
  font-size 2.5 rem
  margin-bottom 10px

.let-the-dogs-out
  height 25px
  width 25px
  &:hover
    & ~ .yard .dogs
      animation get-excited .15s infinite

  @supports (display: contents)
    &:checked
      & ~ .dogmoji
        animation nod .15s infinite
      & ~ .yard
        .kennel
          display contents
          &__front
            display none
          .dog
            animation-iteration-count infinite
            for dog in (1..20)
              &:nth-child({dog})
                if random(10) < 5
                  animation-name move
                else
                  animation-name move-flipped


.yard
  border 4px solid silver
  border-radius 5px
  background-color grey
  height 300px
  width  300px
  display flex
  flex-direction row
  flex-wrap wrap
  justify-content center
  align-items center
  margin 0 auto

.kennel
  display block
  height 150px
  width 150px
  overflow hidden
  position relative

  &__front
    height 150px
    width  150px
    display flex
    justify-content center
    align-items center
    animation rock 2s infinite alternate

  &__frame
    wood-color = #f3a32c
    slat-size = 20px
    background repeating-linear-gradient(180deg, wood-color, wood-color slat-size, darken(wood-color, 30%) slat-size, darken(wood-color, 30%) slat-size + 2px)
    clip-path polygon(0% 100%, 0 40%, 50% 0, 100% 40%, 100% 100%)
    height 120px
    position relative
    width 100px

  &__roof
    background-color #e74c3c
    height 10px
    left 50%
    position absolute
    top 10px
    width 90px

    &--left
      transform-origin left
      transform rotate(45deg) skewX(44deg)

    &--right
      transform-origin 0px
      transform rotate(135deg) skewX(-45deg)

  &__door
    border-radius 25px 25px 0 0
    height 70px
    width 60px
    background-color black
    position absolute
    bottom 0
    left 50%
    transform translateX(-50%)

    .dogs
      position absolute
      bottom 0
      left 50%
      width 60px
      margin-left -30px
      .dog
        position absolute
        font-size 4rem
        bottom 0
        left 50%
      .dog:nth-child(1)
        font-size 2.5rem
        transform translate(-50%, 0%)
      .dog:nth-child(2)
        font-size 1.5rem
        transform translate(-180%, 0%)
      .dog:nth-child(3)
        font-size 1.25rem
        transform translate(120%, 0%)

.dog
  display flex
  font-size 1.5rem
  width 20%
  justify-content center

  for dog in (1..16)
    &:nth-child({dog})
      animation-duration random(10) * .1s
      animation-delay random(10) * .1s

.no-firefox
  display block
  font-size 1.5rem
  text-decoration none

@supports (display: contents)
  .no-firefox
    display none
  label
    text-decoration none
              
            
!

JS

              
                // There is nothing to see here
              
            
!
999px

Console