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

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

              
            
!

CSS

              
                *,
*: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;
    }
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console