octocatstartv

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.

            
              @import "compass/css3";

div {
  height: 50px;
  margin-bottom: 10px;
}

$backColor: #666;
$foreColor: #465298;

.progress {
  // Using percentages prevents weird rendering, using fixed forces positioning to work, so you can align gradients across elements
	background: repeating-linear-gradient(
		-45deg,
		$backColor,
		$backColor 25%,
		shade($backColor,10%) 25%,
		shade($backColor,10%) 50%,
		$backColor 50%
	) top left fixed;
  // Then just define how big the background should be
	background-size: 30px 30px;
  .current {
    width: 25%;
    @include animation(width 5s infinite);
    background: repeating-linear-gradient(
      -45deg,
      $foreColor,
      $foreColor 25%,
      shade($foreColor,10%) 25%,
      shade($foreColor,10%) 50%,
      $foreColor 50%
    ) top left fixed;
    background-size: 30px 30px;
  }
}

// So this one is what happens when you use pixel-based gradients. At time of writing, the bars suffer from rounding errors and are uneven. Even if one day this is fixed, an argument could be made for %-based gradients being more maintainable in case the sizes need to be changed.
.progress-funky {
	background: repeating-linear-gradient(
		-45deg,
		$backColor,
		$backColor 10px,
		shade($backColor,10%) 10px,
		shade($backColor,10%) 20px,
		$backColor 20px
	) top left;
  .current {
    width: 25%;
    animation: width 5s infinite;
    background: repeating-linear-gradient(
      -45deg,
      $foreColor,
      $foreColor 10px,
      shade($foreColor,10%) 10px,
      shade($foreColor,10%) 20px,
      $foreColor 20px
    ) top left;
  }
}

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

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console