css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              <html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>
      Thick Lines: Clouds
    </title>
  </head>

  <body>
    <div class="cloud-deck-1">
      <div class="cloud-left"></div>
      <div class="cloud-right"></div>
    </div>
    <div class="cloud-deck-2">
      <div class="cloud-left"></div>
      <div class="cloud-right"></div>
    </div>
    <div class="cloud-deck-3">
      <div class="cloud-left"></div>
      <div class="cloud-right"></div>
    </div>
    <div class="cloud-deck-4">
      <div class="cloud-left"></div>
      <div class="cloud-right"></div>
    </div>
    <div class="cloud-deck-5">
      <div class="cloud-left"></div>
      <div class="cloud-right"></div>
    </div>
  </body>
</html>

            
          
!
            
              *,
*:before,
*:after {
  margin: 0;
  padding: 0;
}

body {
  background-color: hsl(204, 100%, 37%);
  height: 100vh;
  overflow: hidden;
  position: relative;
}

// Each colour block is a cloud – create a placeholder for shared styles
%cloud-deck {
  height: 25vh;
  position: absolute;
  bottom: 0;
  width: 100%;
}

// Stash our colours in a list...
$cloud-colors: (
  hsl(210, 3%, 73%),
  hsl(220, 3%, 79%),
  hsl(210, 3%, 86%),
  hsl(240, 3%, 92%),
  hsl(0, 0%, 100%)
);

// ...and loop over them to generate our cloud decks
@each $color in $cloud-colors {

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

  // Using the index in the class name gives us ‘.cloud-deck-1’,
  // ‘.cloud-deck-2’, etc.
  .cloud-deck-#{$index} {
    @extend %cloud-deck;

    // The cloud-deck overlap is 15vh. Sass lists are one-indexed; so to get
    // our first clouds to sit at the bottom of the stack, we subtract one
    // from the index to multiply the transform by zero.
    bottom: 15vh * ($index - 1);

    // We’re stacking as we go, so each additional cloud deck goes underneath
    // the previous one
    z-index: $index * -1;

    // Use the colours on the clouds
    .cloud-left,
    .cloud-right {
      &:before,
      &:after {
        background-color: $color;
      }
    }
  }
}

// We use these values a bunch of times, so vars are useful
$small-cloudlet-radius: 21vw;
$big-cloudlet-radius: 32vw;

.cloud-left,
.cloud-right {
  position: relative;
  width: 50%;

  // Each cloud consists of two ‘cloudlets’ (the bumpy bits) –
  // generate them with pseudoelements
  &:before,
  &:after {
    content: '';
    position: absolute;
  }

  // Big cloudlet (the one on the outer edge of the viewport)
  &:before {
    border-radius: $big-cloudlet-radius;
    height: $big-cloudlet-radius * 2;
    top: 0;
    width: $big-cloudlet-radius * 2;
  }

  // Small cloudlet (the one that meets its counterpart in the middle)
  &:after {
    border-radius: $small-cloudlet-radius;
    height: $small-cloudlet-radius * 2;
    top: 11vh;
    width: $small-cloudlet-radius * 2;
  }
}

// The clouds are mirror images of each other, so we can generate them
// with a short list
@each $side in (left, right) {

  // Find the opposite side to correctly position the cloudlets
  // (var needs to be initialized outside the conditional)
  $opposite-side: '';

  @if $side == 'left' {
    $opposite-side: 'right'
  } @elseif $side == 'right' {
    $opposite-side: 'left'
  }

  // Just like we did up top, this gives us ‘.cloud-left’ and ‘.cloud-right’
  .cloud-#{$side} {
    float: $side;

    // Position the cloudlets
    &:before {
      #{$opposite-side}: 20vw;
    }
    &:after {
      #{$opposite-side}: -5vw;
    }
  }
}

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

Console