123

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h4>A button with slanted borders, and a slanty fill.  The slanty bits are made from CSS gradients.<br>Use the mixin and make one for yourself!
</h4>
<button class="fancy-button">Hover me, baby</button>
<h6>
Relies on a magic number, if you're smarter than me and can figure out how to get rid of that, then you get a 🌟</h6>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Lato:400,700);
$master-font-size: 30px;
$color1: #5bf390;
$color2: #ff4cff;
$border-width: 0.3em;
$padding: 1em 1.5em;
//There's some relationship between border width, padding, and angle 
//that a smarter person than me must figure out, until then, long live $magic-number!  
$magic-number: 41.6%;

@mixin slanty-button($border-width, $padding, $color1, $color2, $magic-number) {
  background-repeat: no-repeat;
  background-image: 
    linear-gradient(-60deg, $color2 0%, $color2 $magic-number, $color1 $magic-number, $color1 100%),
    linear-gradient(-60deg, $color2 0%, $color2 calc(100% - #{$magic-number}), $color1 calc(100% - #{$magic-number}), $color1 100%);
  background-position: 0 0, 0 100%, 0 0, 100% 0;
  background-size: 100% $border-width, 100% $border-width, calc(100% + #{$border-width*2}) 100%, 100% calc(100% + #{$border-width*2});
  border: none;
  border-left: $border-width solid $color1;
  border-right: $border-width solid $color2;
  padding: $padding;
  overflow: hidden;
  position: relative;

  &:hover, &:active {
    &:before, &:after {
      transform: translateX(0);
    }
  }
  &:before, &:after {
    content: '';
    display: block;
    position: absolute;
    z-index: -1;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-repeat: no-repeat;
    background-size: 100% calc(100% - #{$border-width*2});
    background-position: 50% $border-width;
    transition: all 0.4s;
  }
  &:before {
    background-image: linear-gradient(-60deg, transparent 0%, transparent 50%, $color1 50%, $color1 100%);
    transform: translateX( calc(-100% + #{$magic-number}) );
  }
  &:after {
    background-image: linear-gradient(120deg, transparent 0%, transparent 50%, $color2 50%, $color2 100%);
    transform: translateX(calc(100% - #{$magic-number}));
  }
}
.fancy-button {
  @include slanty-button($border-width, $padding, $color1, $color2, $magic-number);
  font-size: 1em;
  margin-bottom: 1em;
  transition: all 0.4s;
  &:hover {
    color: white;
  }
}

//scene setting
html {
  font-size: $master-font-size;
  font-family: 'Lato', 'brandon grotesque', 'gotham', futura, helvetica, sans-serif;
  padding: 1em;
  text-align: center;
}
//button reset
button {
  appearance: none;
  background-color: transparent;
  border: none;
  font-family: 'Lato', 'brandon grotesque', 'gotham', futura, helvetica, sans-serif;
  outline: none !important;
}
h4 {
  margin-bottom: 1em;
}
h6 {
  font-size: 0.6em;
}
            
          
!
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.

Console