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="single sample"></div>
<div class="double sample">
  <strong>pattern</strong>
</div>

<div class="zigzag-pattern sample">
  <strong>zigzag pattern</strong>
</div>

<div class="zigzag-pattern fromtop">
  <strong style="color: white">zigzag from top</strong>
</div>

<div class="orange zigzag-pattern onleft">
  <h5>From the left</h5>
</div>

<div class="orange zigzag-pattern onright">
  <h5>From the right</h5>
</div>

<div class="orange zigzag-pattern fromtwoends">
  <strong>from two ends</strong>
</div>

<div class="orange zigzag-pattern fromtwoends swapaxis">
  <strong>from two ends with swapped axis</strong>
</div>

<div class="grey zigzag-pattern">
  <h3>dark block</h3>
</div>
              
            
!

CSS

              
                .sample {
  box-shadow: 0 0 1px 1px #000;
  margin: 30px;
}

.single {
  width: 200px;
  height: 200px;
  background-image: linear-gradient(-45deg, black 100px, transparent 100px);
}

.double {
  /* make wide */
  width: 100%;
  height: 200px;

  /* two triangles */
  background-image: linear-gradient(-45deg, black 100px, transparent 100px),
    linear-gradient(45deg, black 100px, transparent 100px);

  /* contain size to double 140px */
  background-size: 280px;

  /* tighten loose ends */
  background-position: bottom left;
  background-repeat: repeat-x;
}

:root {
  --zigzagbase: 200px;
  --color: black;
}
.zigzag-pattern {
  /* at 70% of size, set height of triangle */
  --zigzag-height: calc(var(--zigzagbase) * 0.7);

  /* gradient at half size stop */
  --zigzag-stop: calc(var(--zigzagbase) / 2);

  /* make background size double the height to create the pattern */
  --zigzag-size: calc(var(--zigzagbase) * 1.4);

  /* min-height to contain the zigzag at all times */
  min-height: var(--zigzag-height);

  background-image: linear-gradient(
      -45deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    ),
    linear-gradient(
      45deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    );

  background-size: var(--zigzag-size);
  background-position: bottom left;
  background-repeat: repeat-x;
}

.fromtop {
  background-image: linear-gradient(
      -135deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    ),
    linear-gradient(
      135deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    );
}

.onleft {
  /* swap x and y axis */
  background-size: 100% var(--zigzag-size);
  background-position: top right;
  background-repeat: repeat-y;

  /* angles on the right half of the circle */
  background-image: linear-gradient(
      -135deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    ),
    linear-gradient(
      -45deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    );
}
.onright {
  background-size: 100% var(--zigzag-size);
  background-position: top right;
  background-repeat: repeat-y;

  /* angles are on left half of the circle */
  background-image: linear-gradient(
      135deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    ),
    linear-gradient(
      45deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    );
}

.fromtwoends {
  /* include all four angles */

  background-image: linear-gradient(
      -45deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    ),
    linear-gradient(
      45deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    ),
    linear-gradient(
      -135deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    ),
    linear-gradient(
      135deg,
      var(--color) var(--zigzag-stop),
      transparent var(--zigzag-stop)
    );
}

.swapaxis {
  /* swap x and y axis */
  background-size: 100% var(--zigzag-size);
  background-position: top right;
  background-repeat: repeat-y;
}

.orange {
  --zigzagbase: 20px;
  --color: white; /* the body bg color */

  background-color: orange;
  margin: 10px;
  padding: 30px;
}

.grey {
  --zigzagbase: 17px;
  --color: white; /* the body bg color */

  background-color: #333;
  color: #fff;
  margin: 10px;
  padding: 30px;
}

              
            
!

JS

              
                
              
            
!
999px

Console