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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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 class="container">
  <div class="graph">
    <svg class="graph__svg-lines graph__top-line" width="" height="150" xmlns="http://www.w3.org/2000/svg">
      <path class="graph__svg-lines graph__top-line" d="m19,149l89,-23l100,-16l68,-30l59,-21l22,-5" />
    </svg>
  <svg class="graph__svg-lines graph__bottom-line" width="300" height="400" xmlns="http://www.w3.org/2000/svg">
    <path class="graph__svg-lines graph__bottom-line" d="m18,149l90,12l243,62" stroke-width="1.5" stroke="#000" fill="#fff"/>
  </svg>
  <span class="rotate-text">U.S. Food Spending</span>
    <div class="graph__line"></div>
    <div class="graph__space"></div>
    <div class="graph__line"></div>
    <div class="graph__space"></div>
    <div class="graph__line"></div>
    <div class="graph__space"></div>
    <div class="graph__line--big"></div>
    <div class="graph__space"></div>
    <div class="graph__line"></div>
    <div class="graph__space"></div>
    <div class="graph__line"></div>
    <div class="graph__space"></div>
    <div class="graph__line"></div>
    <div class="triangle triangle--up">
      <div class="triangle__content">
        <span class="small dollar-sign">$</span>
        50
        <span class="small">billion</span>
<!--         <span class="dollar-sign"></span>       -->
      </div>
    </div>
    <div class="triangle triangle--down">
      <div class="triangle__content--bottom triangle__content">
        <span class="small dollar-sign">$</span>
        15 
        <span class="small">Billion</span>
      </div>
    </div>
  </div>
</div>



              
            
!

CSS

              
                $background: #F0F0F0;
$red: #E8522A;
$blue: #50B7D6;
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: $background;
}

.container {
  height: 325px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rotate-text {
  position: absolute;
  left: -120px;
  top: 45%;
  letter-spacing: 1px;
  font-size: 18px;
  text-transform: uppercase;
  transform: rotate(-90deg);
}

.graph {
  position: relative;
  width: 300px;

  &__svg-lines {
    position: absolute;
    top: -53px;
    left: -17px;
    width: 300px;
    opacity: 1;
    stroke-width: 2;
    fill: none;
    stroke-dashoffset: 300;
    stroke-dasharray: 300;
  }
  
  &__top-line {
    stroke: $blue;
    animation: line-animate 3s 1.3s ease-in forwards;    
  }
  
  &__bottom-line {
    stroke: $red;
    animation: line-animate 3s 1.3s ease-in forwards;
  }
  
  &__bottom-line {
    position: absolute;
    left: -15px;
    top: -55px;
  }
  
  &__space {
    height: 30px;
  }
  
  &__line {
    height: 1px;
    background: gray;
    &--big {
      height: 4px;
      background: gray;
    }
  }
}

$triangle-width: 100px;
$triangle-height: 100px;
$triangle-lr: 50px;

.triangle {
  border-left: $triangle-lr solid transparent;
  border-right: $triangle-lr solid transparent;
  width: $triangle-width;
  position: absolute;
  right: -30px;
  bottom: 50%;
}

.triangle--up {
  border-bottom: $triangle-height solid $blue;
  bottom: 0;
  animation: lift-triangle 1s ease forwards;
}

.triangle--down {
  border-top: $triangle-height solid $red;
  top: 0;
  animation: drop-triangle 1s ease forwards;
}

.triangle__content {
  position: absolute;
  text-transform: uppercase;
  top: 50px;
  left: -30px;
  color: white;
  font-size: 30px;
  text-align: center;
  line-height: 15px;
  opacity: 0;
  animation: lift-triangle-content 1s 1s ease forwards;
  &--bottom {
    animation: drop-triangle-content 1s 1s ease forwards;
    top: -90px;
  }
}

.small {
  font-size: 15px;
}

.dollar-sign {
  position: absolute;
  top: -8px;
  left: 10px;
}

@keyframes lift-triangle {
  from { opacity: 0; }
  to { opacity: 1; bottom: 60%; }
}

@keyframes drop-triangle {
  from { opacity: 0; }
  to { opacity: 1; top: 60%; }
}

@keyframes lift-triangle-content {
  from { opacity: 0; top: 100px; }
  to { opacity: 1; top: 50px; }
}

@keyframes drop-triangle-content {
  from { opacity: 0; top: -140px; }
  to { opacity: 1; top: -90px; }
}

@keyframes line-animate {
  to { stroke-dashoffset: 0; }
}
              
            
!

JS

              
                
              
            
!
999px

Console