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

              
                %div.sky
  %div.moon
  -(0..13).each do
    %div.star
  %div.mountains
    %div.range
      -(0..3).each do
        %div.mountain
    %div.range
      -(0..5).each do
        %div.mountain
%div.desert
  %div.cactus
    %div.flower
      %div.pedal
      %div.pedal
      %div.pedal
      %div.pedal
    %div.arm.left
    %div.center
    %div.arm.right
  %div.cactus
    %div.owl
      %div.head
      %div.body
      %div.feet
    %div.arm.left
    %div.center
    %div.arm.right
  %div.perspective
    %div.road
              
            
!

CSS

              
                // mountains
$blue: #607C92;
$grey: #8795A0;

body {
  margin: 0;
}

.sky {
  background: linear-gradient(#184655, #dfdfcc 85%);
  overflow: auto;
  position: relative;
}

.mountains {

  padding: 0 10%;

  .mountain {
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    display: inline-block;
    vertical-align: middle;
    border-radius: 3%;

  }

  .range {
    overflow: hidden;
  }

  .range:nth-child(1) {

    .mountain {
      margin-top: 6%;
      margin-bottom: -15%;
      margin-left: -8%;

      &:nth-child(1) {
        padding: 9%;
        background: linear-gradient(23deg, $blue 70%, darken($blue, 8%) 70%);
        margin-left: 12%;
      }

      &:nth-child(2) {
        padding: 13%;
        background: linear-gradient(25deg, $blue 68%, darken($blue, 8%) 68%);
      }

      &:nth-child(3) {
        padding: 12%;
        background: linear-gradient(-17deg, $blue 90%, transparent 80%), 
                    linear-gradient(25deg, $blue 68%, darken($blue, 8%) 68%);
      }

      &:nth-child(4) {
        padding: 13.5%;
        background: linear-gradient(75deg, transparent 50%, darken($blue, 8%) 50%), 
                    linear-gradient(14deg, $blue 80%, darken($blue, 8%) 80%);
      }
    }
  }

  .range:nth-child(2) {
    margin-top: -17%;

    .mountain {
      margin-top: 6%;
      margin-bottom: -11.5%;
      margin-left: -4%;

      &:nth-child(1) {
        padding: 6.3%;
        background: linear-gradient(13deg, $grey 80%, darken($grey, 8%) 80%);
        margin-left: 8%;
      }

      &:nth-child(2) {
        padding: 10%;
        background: linear-gradient(0deg, $grey 88%, transparent 80%), 
                    linear-gradient(37.5deg, $grey 56.5%, darken($grey, 8%) 56.5%);
        margin-left: -3%;
      }

      &:nth-child(3) {
        padding: 11.5%;
        background: linear-gradient(10deg, $grey 85%, darken($grey, 8%) 85%);
        margin-left: -7%;
      }

      &:nth-child(4) {
        padding: 10%;
        background: linear-gradient(-10deg, $grey 80%, transparent 80%), 
                    linear-gradient(25deg, $grey 68%, darken($grey, 8%) 68%);
      }

      &:nth-child(5) {
        padding: 5.7%;
        background: linear-gradient(13deg, $grey 80%, darken($grey, 8%) 80%);
      }

      &:nth-child(6) {
        padding: 7.3%;
        background: linear-gradient(13deg, $grey 80%, darken($grey, 8%) 80%);
      }
    }
  }
}


.moon {
  margin: 2%;
  padding: 7%;
  width: 0;
  background-color: #F0F3D9;
  border-radius: 100%;
  box-shadow: inset -1.2vw -1.2vw rgba(220, 225, 172, 0.50),
              inset .5vw .5vw 5vw #a5a5a5,
              0 0 2.5vw rgba(219, 221, 198, 0.50);

  display: inline-block;
}

.star {
  width: 4px;
  height: 4px;
  border-radius: 100%;
  position: absolute;

  background-color: #d2d0cc;
  box-shadow: 0 0 .125em .125em rgba(161, 169, 176, 0.50);

  &:nth-child(2) {
    left: 22%;
    top: 49%;
  }

  &:nth-child(3) {
    left: 29%;
    top: 29%;
  }

  &:nth-child(4) {
    left: 35%;
    top: 35%;
  }

  &:nth-child(5) {
    left: 37%;
    top: 7%;
  }

  &:nth-child(6) {
    left: 45%;
    top: 15%;
  }

  &:nth-child(7) {
    left: 50%;
    top: 37%;
  }

  &:nth-child(8) {
    left: 56%;
    top: 13%;
  }

  &:nth-child(9) {
    left: 63%;
    top: 22%;
  }

  &:nth-child(10) {
    left: 60%;
    top: 47%;
  }

  &:nth-child(11) {
    left: 67%;
    top: 47%;
  }

  &:nth-child(12) {
    left: 72%;
    top: 38%;
  }

  &:nth-child(13) {
    left: 72%;
    top: 9%;
  }

  &:nth-child(14) {
    left: 49%;
    top: 28%;
  }

  &:nth-child(15) {
    left: 76%;
    top: 55%;
  }
}

@-webkit-keyframes glow {
  0% {
    background-color: #d2d0cc;
    box-shadow: 0 0 .125em .125em rgba(161, 169, 176, 0.50);
  }
  100% {
    background-color: whitesmoke;
    box-shadow: 0 0 .5em .125em #ECECEC;
  }
}

@keyframes glow {
  0% {
    background-color: #d2d0cc;
    box-shadow: 0 0 .125em .125em rgba(161, 169, 176, 0.50);
  }
  100% {
    background-color: whitesmoke;
    box-shadow: 0 0 .5em .125em #ECECEC;
  }
}

.star:nth-child(odd) {
  -webkit-animation: glow 2s infinite alternate;
  animation: glow 2s infinite alternate;
}

.star:nth-child(even) {

  -webkit-animation: glow 2s infinite alternate;
  animation: glow 2s infinite alternate;
  -webkit-animation-delay: 2s;
  animation-delay: 2s;
}

.star:nth-child(4n) {

  -webkit-animation: glow 2s infinite alternate;
  animation: glow 2s infinite alternate;
  -webkit-animation-delay: 1s;
  animation-delay: 1s;
}





/* Desert */
$desert: #958865;
$black: #3c3c3c;
$yellow: #d7d325;

.desert {
  position: relative;
  overflow: hidden;

  // this could have been a triangle
  .perspective {
    -webkit-perspective: 1.7em;
    perspective: 1.7em;


    background: linear-gradient($desert 50%, lighten($desert, 5%));
    overflow: hidden;

    position: relative;
    z-index: -2;

    margin-top: -11.5em;
    .road {
      width: 12%;
      margin: 0 auto;

      background-color: rgb(60, 60, 60);
      -webkit-transform: rotateX(20deg);
      transform: rotateX(20deg);

      height: 30em;

      border-right: 1.5vw solid;
      border-left: 1.5vw solid;
      border-color: lighten($desert, 7%);
      background: linear-gradient(to right, $black 90%, transparent 90%), 
                  linear-gradient($black 30%, $yellow 30%, $yellow 60%, $black 60%);
      background-size: 55% 5%;
      -webkit-animation: drive 3s linear infinite;
      animation: drive 3s linear infinite;

    }
  }
}

@-webkit-keyframes drive {
  100% { background-position: 0% 21%; }
}

@keyframes drive {
  100% { background-position: 0 0, 0 0; }
  100% { background-position: 0 0, 0 21%; }
}



/* Cactus */
$green: #38823D;
$dark_green: darken(#38823D, 5%);
$red: rosybrown;

.cactus {

  position: absolute; 
  width: 25%;
  display: inline-block;


  .center, .arm {
    float: left;
  }

  .center {
    padding: 65% 20%;
    // could have used 1 line with a smaller background size, but resizing makes the lines jiggle
    background: linear-gradient(to right, $green 16%, $dark_green 16%,
                                          $dark_green 20%, $green 20%,

                                          $green 38%, $dark_green 38%,
                                          $dark_green 42%, $green 42%,

                                          $green 60%, $dark_green 60%,
                                          $dark_green 64%, $green 64%,

                                          $green 82%, $dark_green 82%,
                                          $dark_green 86%, $green 86%);

    border-top-left-radius: 45% 15%;
    border-top-right-radius: 45% 15%;
  }

  .arm {
    // 1% diff for non-retina
    background: radial-gradient(transparent 40%, $green 41%, $green 48%, $dark_green 48%, $dark_green 51%, $green 51%, $green 61%, $dark_green 61%, $dark_green 64%, $green 64%);
    padding: 15%;

    // this was tricky, quarter circle, co-ordinates for position below
    background-size: 200% 200%;

    &::before {
      content: '';
      background: radial-gradient($green 23%, $dark_green 23%, $dark_green 37%, $green 37%);
      z-index: -1;
      padding: 6.5%;
      position: absolute;
      border-radius: 50%;
      margin-top: -21%;
    }

    &.left {
      border-radius: 0 0 0 100%;
      background-position: 0% 100%;
      margin-top: 20%;
      &::before {
        margin-left: -15%;
      }
    }
    &.right {
      border-radius: 0 0 100% 0;
      background-position: 100% 100%;
      margin-top: 50%;
      &::before {
        margin-left: 2.25%;
      }
    }
  }
}



.pedal {
  position: absolute; // it's on top
  left: 55%;
  top: 10%;
  border-radius: 7%;
  padding: 7%;
  background-color: $red;


  &:nth-child(1) {
    -webkit-transform: rotate(25deg);
    transform: rotate(25deg);
  }

  &:nth-child(2) {
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
  }

  &:nth-child(3) {
    -webkit-transform: rotate(75deg);
    transform: rotate(75deg);
  }

  &:nth-child(4) {
    background: radial-gradient(gold 20%, transparent 20%, $red 20%);
  }
}



$brown: #A78B67;
$light_brown: #CBB8A2;
$dark_brown: #8D7F6D;

$beak: goldenrod;
$dark_yellow: #E4C51D;

.owl {

  width: 40%;
  margin: 0 auto;

  div {
    margin: 0 auto;
  }

  .head {
    width: 45%;
    padding: 20% 0;
    border: .8vw solid $dark_brown; // 1.4vw
    border-top-color: transparent;
    border-top-width: 1.5vw; // 4vw;
    border-radius: 40%; // causes lines in the border in FF

    background: radial-gradient($light_brown 80%, transparent 80%);
    background-size: 62% 70%;
    background-clip: padding-box;
    background-color: goldenrod;
    background-position: -25% 10%;

    position: relative;



    &:before, &:after {
      content: '';
      background: radial-gradient(black 15%, gold 50%);
      border-radius: 50%;
      position: absolute;
      padding: 15%;
      top: 20%;
    }

    &:before {
      left: 10%;
    }

    &:after {
      left: 60%;
    }
  }

  .body {
    padding: 40% 30%;
    width: 0;
    border-radius: 25% 25% 35% 35% / 35% 35% 60% 60%;

    background: linear-gradient(64deg, $brown 33.5%, transparent 36%), linear-gradient(-64deg, $brown 33.5%, transparent 36%);
    background-size: 26% 26%;
    background-color: #cbb8a2;

    // have to adjust these
    border: .8vw solid $dark_brown; // 1.6
    border-bottom-width: 1.2vw; // 3

    border-bottom-color: transparent;


    background-clip: padding-box;




  }

  .feet {
    padding: 8% 23%;
    background: radial-gradient($dark_yellow 70%, transparent 75%);
    // goes to 22
    background-size: 33% 100%;
    width: 0;
    margin-top: -12%;
  }

}


/* ugh firefox, the borders on the owl don't scale, so I use zoom, but firefox doesn't support zoom */
@-moz-document url-prefix() {
  .owl {
    .body, .head {
      border: none;
    }
  }
}

.cactus {
  position: absolute;


  .owl {
    -webkit-animation: owl 10s ease-in infinite;
    animation: owl 10s ease-in infinite;
    -webkit-animation-delay: 4s;
    animation-delay: 4s;
    opacity: 0;
  }

  &:nth-child(1) {
    left: 0%;
    -webkit-animation: left_cactus 10s ease-in infinite;
    animation: left_cactus 10s ease-in infinite;
  }

  &:nth-child(2) {
    left: 75%;
    width: 0%;
    -webkit-animation: right_cactus 10s ease-in infinite;
    animation: right_cactus 10s ease-in infinite;
    -webkit-animation-delay: 4s;
    animation-delay: 4s;
  }
}


/* Animations for the cactus and owl */
@-webkit-keyframes closer {
  0% { width: 0%; }
  100% { width:25%; }
}

@keyframes closer {
  0% { width: 0%; }
  100% { width:25%; }
}

@-webkit-keyframes owl {
  0% { zoom: 0.01; opacity: 1;}
  100% { zoom: 2; opacity: 1;}
}

@keyframes owl {
  0% { zoom: 0.01; opacity: 1;}
  100% { zoom: 2; opacity: 1;}
}

@-webkit-keyframes left_cactus {
  0% { width: 0%; top: 5%; left: 40%; }
  100% { width: 35%; top: 100%; left: -80%; }
}

@keyframes left_cactus {
  0% { width: 0%; top: 5%; left: 40%; }
  100% { width: 35%; top: 100%; left: -80%; }
}

@-webkit-keyframes right_cactus {
  0% { width: 0%; top: 5%; left: 65%; }
  100% { width: 35%; top: 80%; left: 165%; }
}

@keyframes right_cactus {
  0% { width: 0%; top: 5%; left: 65%; }
  100% { width: 35%; top: 80%; left: 165%; }
}
              
            
!

JS

              
                
              
            
!
999px

Console