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.

    <meta name="viewport" content="width=device-width, initial-scale=1">
      Thick Lines: Peaks

    <div class="peak-group-1">
      <div class="left-peak"></div>
      <div class="right-peak"></div>
    <div class="peak-group-2">
      <div class="left-peak"></div>
      <div class="right-peak"></div>
    <div class="peak-group-3">
      <div class="left-peak"></div>
      <div class="right-peak"></div>
    <div class="peak-group-4">
      <div class="left-peak"></div>
      <div class="right-peak"></div>
    <div class="peak-group-5">
      <div class="left-peak"></div>
      <div class="right-peak"></div>

*:after {
  margin: 0;
  padding: 0;

body {
  background-color: hsl(181, 49%, 56%);
  height: 100vh;
  overflow: hidden;
  position: relative;

// Each group contains two peaks (in retrospect, I should have
// called this ‘%twin-peaks’)
%peak-group {
  position: absolute;
  width: 100%;

// We use these a bunch, so it’s best to stash them in vars
$peak-height: 24vh;
$peak-width: 78vw;

// Generate each peak using the good old-fashioned CSS triangle trick
%peak {
  border-color: transparent;
  border-style: solid;
  // The left and right borders add up to our desired width, so we divide
  // the desired width by two to get the correct ‘border-width’
  border-width: $peak-height ($peak-width / 2);
  height: 0;
  position: absolute;
  bottom: 100%;
  width: 0;
  // Use a pseudoelement to provide the ‘base’ of our peaks to avoid
  // the ‘floating mountain’ effect
  &:after {
    content: '';

    // Kind of arbitrary, really; this could have been any value that
    // prevented daylight between the peaks
    height: $peak-height;
    position: absolute;

    // Subtracting 1px fixes an occasional subpixel-rounding gremlin
    top: calc(#{$peak-height} - 1px);
    // Since the width of the parent element is zero, we need to bump this out
    // to the left by half the width of the peak so it lines up properly
    left: ($peak-width / 2) * -1;
    width: $peak-width;

// Stash our colours in a list...
$peak-colors: (
  hsl(28, 100%, 24%),
  hsl(27, 91%, 31%),
  hsl(26, 81%, 39%),
  hsl(25, 77%, 47%),
  hsl(25, 91%, 54%)

// ...and loop over it to draw our peak groups
@each $color in $peak-colors {

  // It’s handy to stash this in a var
  $index: index($peak-colors, $color);

  // Using the index in the class name gives us ‘.peak-group-1’,
  // ‘.peak-group-2’, etc.
  .peak-group-#{$index} {
    @extend %peak-group;
    // The peak group overlap is 17vh. Sass lists are one-indexed; so to get
    // our first peaks to sit at the bottom of the stack, we subtract one
    // from the index to multiply the transform by zero.
    bottom: 17vh * ($index - 1);
    // We’re stacking as we go, so each additional leaf goes underneath
    // the previous one
    z-index: $index * -1;
    .right-peak {
      border-bottom-color: $color;
      &:after {
        background-color: $color;

.right-peak {
  @extend %peak;

// I could get fancy and use a list for this like I did for ‘Foliage’, but
// that level of complexity isn’t really necessary here

.left-peak {
  left: -13vw;

.right-peak {
  right: -13vw;

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