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

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="penta gon">PENTAGON</div>
<div class="hexa gon">HEXAGON</div>
<div class="hepta gon">HEPTAGON</div>
<div class="octa gon">OCTAGON</div>
<div class="nona gon">NONAGON</div>
              
            
!

CSS

              
                html, body { width: 100%; height: 100%; }
body {
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flex;
  display: flex;
  -webkit-justify-content: space-around;
  -moz-justify-content: space-around;
  -ms-justify-content: space-around;
  justify-content: space-around;
  -webkit-align-items: center;
  -moz-align-items: center;
  -ms-align-items: center;
  align-items: center;
}
.gon {
  width: 220px;
  height: 220px;
  background: url('https://i.imgur.com/IEiqEV0.jpg') no-repeat 50% 50%;
  background-size: 220px 220px;
  
  /* Text styling */
  line-height: 220px;
  text-align: center;
  font-family: sans-serif;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 6px;
  color: #fff;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  transition: color 500ms ease, text-shadow 500ms ease;
}
.gon:hover {
  color: #fff;
  text-shadow: 0 0 10px white;
}

.penta {
  height: 200px;
  -webkit-clip-path: polygon(
    50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%
  );
  -moz-clip-path: polygon(
    50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%
  );
  -ms-clip-path: polygon(
    50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%
  );
  clip-path: polygon(
    50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%
  );
}
.hexa {
  width: 190px;
  -webkit-clip-path: polygon(
    50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%
  );
  -moz-clip-path: polygon(
    50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%
  );
  -ms-clip-path: polygon(
    50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%
  );
  clip-path: polygon(
    50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%
  );
}
.hepta {
  height: 215px;
  -webkit-clip-path: polygon(
    50% 0, 90% 19%, 100% 62%, 72% 100%, 28% 100%, 0 62%, 10% 19%
  );
  -moz-clip-path: polygon(
    50% 0, 90% 19%, 100% 62%, 72% 100%, 28% 100%, 0 62%, 10% 19%
  );
  -ms-clip-path: polygon(
    50% 0, 90% 19%, 100% 62%, 72% 100%, 28% 100%, 0 62%, 10% 19%
  );
  clip-path: polygon(
    50% 0, 90% 19%, 100% 62%, 72% 100%, 28% 100%, 0 62%, 10% 19%
  );
}
.octa {
  -webkit-clip-path: polygon(
    29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%
  );
  -moz-clip-path: polygon(
    29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%
  );
  -ms-clip-path: polygon(
    29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%
  );
  clip-path: polygon(
    29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%
  );
}
.nona {
  -webkit-clip-path: polygon(
    50% 0, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%
  );
  -moz-clip-path: polygon(
    50% 0, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%
  );
  -ms-clip-path: polygon(
    50% 0, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%
  );
  clip-path: polygon(
    50% 0, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%
  );
}
              
            
!

JS

              
                /*
Texturized 2D shapes with CSS clip-path: polygon();. As of now, works only in Chrome.

The current implementation has no effect on cursor collision. That means the mouse events fire, and :hover styles are applied even when mouse is hovering over the clipped parts of an element. This should be fixed in the future.

Also, the clipping happens after all other drawing, so it clips everything including scrollbars and our belowed box-shadows :)
*/
              
            
!
999px

Console