Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <button class="button button--gradient" type="button">Visit the website</button>
              
            
!

CSS

              
                $brand-primary: #080E30;
$border-width: 2px;

@mixin purple2blue() {
	background: #df19b5;
	background: linear-gradient(to right, #df19b5 33.33%,#2989d8 66.66%,#207cca 100%,#0597dd 100%);
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  
  height: 100vh;
    
  background-color: $brand-primary;
  
  text-align: center;
}

button {
  cursor: pointer;
}

.button {
  display: inline-block;

	padding: 1em 2em;
	border: none;

	text-transform: uppercase;
	text-align: center;
	font-weight: 600;
}

.button--gradient {
  @include purple2blue();

	position: relative;
	z-index: 0;

	color: #D6D1D1;

	font-weight: 700;

	// Add dark background inner to create border
	&:before {
		content: "";
		
		position: absolute;
		top: $border-width;
		bottom: $border-width;
		left: $border-width;
		right: $border-width;
		z-index: -1;

		display: block;

		background-color: $brand-primary;
	}

	.cssclippathpolygon & {
		clip-path: polygon(10px 0, calc(100% - 11px) 0, 100% 11px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0% calc(100% - 10px), 0% 11px);
	}
  
	.cssclippathpolygon &:before {
		clip-path: polygon(10px 1px, calc(100% - 11px) 1px, calc(100% - 1px) 11px, calc(100% - 1px) calc(100% - 10px), calc(100% - 10px) calc(100% - 1px), 10px calc(100% - 1px), 1px calc(100% - 10px), 1px 11px)
	}
}
              
            
!

JS

              
                // Test for polygon() support to progresively enchance. Firefox does not have support

// CSS Clip Path Polygon tests from https://codepen.io/shshaw/pen/yyOaqW
(function(Modernizr){

    // Here are all the values we will test. If you want to use just one or two, comment out the lines of test you don't need.
    var tests = [
      { name: 'svg', value: 'url(#test)' }, // False positive in IE, supports SVG clip-path, but not on HTML element
      { name: 'inset', value: 'inset(10px 20px 30px 40px)' },
      { name: 'circle', value: 'circle(60px at center)' },
      { name: 'ellipse', value: 'ellipse(50% 50% at 50% 50%)' },
      { name: 'polygon', value: 'polygon(50% 0%, 0% 100%, 100% 100%)' }
    ];

    var t = 0,
        name, value, prop;

    for (; t < tests.length; t++) {
      name = tests[t].name;
      value = tests[t].value;
      Modernizr.addTest('cssclippath' + name, function(){
        // Try using window.CSS.supports
        if ( 'CSS' in window && 'supports' in window.CSS ) {
          for (var i = 0; i < Modernizr._prefixes.length; i++) {
            prop = Modernizr._prefixes[i] + 'clip-path'
            
            if ( window.CSS.supports(prop,value) ) { return true; }
          }
          return false;
        }
        // Otherwise, use Modernizr.testStyles and examine the property manually
        return Modernizr.testStyles('#modernizr { '+Modernizr._prefixes.join('clip-path:'+value+'; ')+' }',function(elem, rule) {
          var style = getComputedStyle(elem),
              clip = style.clipPath;

          if ( !clip || clip == "none" ) {
            clip = false;

            for (var i = 0; i < Modernizr._domPrefixes.length; i++) {
              test = Modernizr._domPrefixes[i] + 'ClipPath';
              if ( style[test] && style[test] !== "none" ) {
                clip = true;
                break;
              }
            }
          }

          return Modernizr.testProp('clipPath') && clip;
        });
      });

    }

  })(Modernizr);
              
            
!
999px

Console