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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.fruit
  %div.crown
    -(0..6).each do
      %div.leaves
        -(0..5).each do
          %div.leaf
  %div.pineapple
    -(0..140).each do
      %div.cell
            
          
!
            
              // Hover on the pineapple!
$aqua: rgb(29, 173, 201);
$jungle: rgb(37, 163, 128);
$yellow: #FFE000;
$brown: #CFB02E;
$green: #0F8828;

body {
  margin: 0;
  background-image: linear-gradient(45deg, $jungle 25%, $aqua 25%, $aqua 50%, $jungle 50%, $jungle 75%, $aqua 75%);
  background-size: 3.125em 3.125em;
  &:hover {
    -webkit-animation: barberpole 2s linear infinite;
    animation: barberpole 2s linear infinite;
  }
}

@-webkit-keyframes barberpole {
  0% { background-position: 0; }
  100% { background-position: 3.125em; }
}

@keyframes barberpole {
  0% { background-position: 0; }
  100% { background-position: 3.125em; }
}

.fruit {
  width: 28.125em;
  margin: 2em auto;
}

.pineapple {
  position: relative;
  left: 5.625em;
  margin-top: -3.750em;

  width: 17.813em;
  height: 22.500em;
  border-radius: 50% 50% 60% 60%/50% 50% 50% 50%;
  overflow: hidden;

  .cell {
    height: 2.6em;
    width: 2.6em;
    display: inline-block;
    border-radius: 45% 0 70% 0;
    position: relative;
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    background-image: radial-gradient(circle at bottom right, $yellow 60%, $brown 64%, $green 100%);
    margin-top: -1.375em;
    margin-left: -1em;
    left: 1.250em;
    top: 1.875em;

    &:nth-child(2n) {
      z-index: -1;
      background-image: radial-gradient(circle at bottom right, $yellow 0%, $brown 55%, $green 100%);
    }
  }

  &:hover {
    .cell:nth-child(2n+1) {
      -webkit-animation: up 4s linear infinite;
      animation: up 4s linear infinite;
    }
  }
}

@-webkit-keyframes up {
  0% { background-position: 0em; }
  100% { background-position: 2.6em; }
}

@keyframes up {
  0% { background-position: 0em; }
  100% { background-position: 2.6em; }
}

.crown {

  // every leaf
  .leaf {

    display: inline-block;
    box-sizing: border-box;
    width: 6.25em;
    margin-left: -3.750em;

    // by column
    &:nth-child(3) {
      border-color: #2E7E10;
    }

    &:nth-child(6) {
      border-color: #006434;
    }

    &:nth-child(1) {
      border-color: rgb(0, 100, 0);
      margin: 0;
    }

    &:nth-child(2) {
      border-color: rgb(46, 141, 48);
    }

    &:nth-child(4) {
      border-color: #309232;
    }

    &:nth-child(5) {
      border-color: rgb(45, 129, 45);
    }
  }

  // by rows
  .leaves {
    position: relative;
    left: 4.5em;

    // each of row of leaves has left and right half
    // each of row of leaves differs by height, radius, angle

    // flat leaves commonality
    &:nth-child(2), &:nth-child(4) {
      left: 1.25em;
      margin-top: -10.313em;

      .leaf {
        height: 12.500em;
        border-radius: 50%;
        box-sizing: content-box;

        &:nth-child(-n+3) {
          -webkit-transform: rotate(-50deg);
          transform: rotate(-50deg);
          border-right-width: 1.125em;
          border-right-style: solid;
        }

        &:nth-child(n+4) {
          -webkit-transform: rotate(55deg);
          transform: rotate(55deg);
          border-left-width: 1.125em;
          border-left-style: solid;
        }
      }
    }

    &:nth-child(1) .leaf {
      height: 12.500em;
      border-radius: 50%;

      &:nth-child(-n+3) {
        -webkit-transform: rotate(-35deg);
        transform: rotate(-35deg);
        border-right-width: 1.563em;
        border-right-style: solid;
      }

      &:nth-child(n+4) {
        -webkit-transform: rotate(35deg);
        transform: rotate(35deg);
        border-left-width: 1.563em;
        border-left-style: solid;
      }
    }

    &:nth-child(3) {
      margin-top: -8.750em;
      .leaf {
        height: 10.938em;
        border-radius: 50%;

        &:nth-child(-n+3) {
          -webkit-transform: rotate(-30deg);
          transform: rotate(-30deg);
          border-right-width: 1.438em;
          border-right-style: solid;
        }

        &:nth-child(n+4) {
          -webkit-transform: rotate(30deg);
          transform: rotate(30deg);
          border-left-width: 1.438em;
          border-left-style: solid;
        }
      }
    }

    &:nth-child(5) {
      margin-top: -8.750em;
      .leaf {
        height: 9.375em;
        border-radius: 45%;

        &:nth-child(-n+3) {
          -webkit-transform: rotate(-30deg);
          transform: rotate(-30deg);
          border-right-width: 1.438em;
          border-right-style: solid;
        }

        &:nth-child(n+4) {
          -webkit-transform: rotate(30deg);
          transform: rotate(30deg);
          border-left-width: 1.438em;
          border-left-style: solid;
        }
      }
    }

    &:nth-child(6) {
      margin-top: -6.250em;
      .leaf {
        height: 7.813em;
        border-radius: 42%;

        &:nth-child(-n+3) {
          -webkit-transform: rotate(-25deg);
          transform: rotate(-25deg);
          border-right-width: 1.500em;
          border-right-style: solid;
        }

        &:nth-child(n+4) {
          -webkit-transform: rotate(25deg);
          transform: rotate(25deg);
          border-left-width: 1.500em;
          border-left-style: solid;
        }
      }
    }

    &:nth-child(7) {
      margin-top: -5em;
      .leaf {
        height: 6.250em;
        border-radius: 40%;

        &:nth-child(-n+3) {
          -webkit-transform: rotate(-20deg);
          transform: rotate(-20deg);
          border-right-width: 1.563em;
          border-right-style: solid;
        }

        &:nth-child(n+4) {
          -webkit-transform: rotate(20deg);
          transform: rotate(20deg);
          border-left-width: 1.563em;
          border-left-style: solid;
        }
      }
    }

  }
}
            
          
!
999px
Loading ..................

Console