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 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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 class="container">

  <h1> <span>border-gradient</span> demo</h1>

<div class="circles">
  <div class="circle"></div>
  <div class="circle"></div>
  
  <div class="circle-multiple">
    <div class="circle"></div>
    <div class="circle"></div>
    <div class="circle"></div>
  </div>
</div>
  
  <a class="btn" href="https://twitter.com/exah" target="_blank">
    Follow @exah on Twitter
  </a>

</div>
            
          
!
            
              @import "bourbon";

/// border-gradient mixin: ///

@mixin border-gradient($from, $to, $weight: 0) {
  $mix-main: mix($from, $to);
  $mix-sub-from: mix($mix-main, $from);
  $mix-sub-to: mix($mix-main, $to);
  
  box-shadow: 0 1px 0 $weight rgba($mix-sub-to, .25),
              0 -1px 0 $weight rgba($mix-sub-from, .25),
              1px 0 0 $weight rgba($mix-sub-to, .25),
              -1px 0 0 $weight  rgba($mix-sub-from, .25),
              1px -1px 0 $weight rgba($mix-main, .5),
              -1px 1px 0 $weight rgba($mix-main, .5),
              1px 1px 0 $weight rgba($to, .75),
              -1px -1px 0 $weight rgba($from, .75);
}

/// BASIC EXAMPLE ///

.circle {
  @include size(100px 100px);
  
  border-radius: 100%;
  
  @include border-gradient(red, yellow);
}


////////////// OTHER EXAMPLES ////////////////


.circle {
  &:nth-of-type(2) {
    @include border-gradient(skyblue, hotpink);

    animation: rotateThis 1s linear infinite;
  }

  &:nth-of-type(3) {
    @include border-gradient(#E14847, #B53BB4);
  }
  
  &-multiple { @include size(100px 100px); }
  
  &-multiple & {
    @include position(absolute, 0px 0px 0px 0px);
    margin: auto;
    
    &:nth-of-type(1) { animation: psycho 2s linear infinite; }
    &:nth-of-type(2) { animation: psycho 2s linear .1s infinite; }
    &:nth-of-type(3) { animation: psycho 2s linear .25s infinite; }
  }
 
}

@keyframes rotateThis {
  from {
    transform: rotate(0deg) scale(1);
  }
  
  to {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes psycho {
  0% {
    transform: rotate(0deg) scale(1) translate(0, 0);
  }
  
  33% {
    transform: rotate(360deg) scale(1) translate(5px, 5px);
  }
  
  66% {
    transform: rotate(720deg) scale(1) translate(-5px, -5px);
  }
  
  100% {
    transform: rotate(1080deg) scale(1) translate(0, 0);
  }
}



.btn {
  border: none;
  display: inline-block;
  background: transparent;
  
  color: rgba(white, .7);
  background: rgba(white, .05);
  text-decoration: none;
  
  padding: 15px 20px;
  
  border-radius: 10px;
  
  transition: all .2s;
  
  @include border-gradient(gray, darkgray);
  
  &:hover {
    @include border-gradient(hotpink, skyblue);
    color: white;
    background: rgba(skyblue, .05);
  }
}


///// OTHER /////

.circles > * {
  display: inline-block; vertical-align: top;
  
  position: relative;
  margin: 0 2%;
}

.circles { 
  transform: translateZ(0); 
  margin-bottom: 100px;
}

body {
  background-color: #222; color: #fff;
  text-align: center;
}

.container {
  overflow: hidden;
  padding-bottom: 150px;
}


h1 {
  font: 100 50px/1.25em "Helvetica Neue", Helvetica, Arial, sans-serif;
  margin-bottom: 50px;
  
  span {
    font-weight: 300;
  }
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console