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

              
                <div class="container">
  <p>Don't do this, don't you dare. You will not like it.</p>
<div class="image-stack">
  <div class="image-stack__item image-stack__item--bottom">
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/110238/texture-waves2.jpeg" alt="">
  </div>
  <div class="image-stack__item image-stack__item--top">
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/110238/portrait-1-cropped.jpg" alt="">
  </div>
</div>
<p>The text is above the image because we have taken the background image, which is taller than the top image out of the document flow and now the only content height that is recognized is the top image that is still statically positioned.</p>
</div>

              
            
!

CSS

              
                // Non relevant styles
* {
  box-sizing: border-box;
}

p {
  font-size: 20px;
  font-family: sans-serif;
  color: #6439a9;
}

.container {
  padding: 100px 30px;
  width: 100%;
  margin: 0 auto;
  max-width: 800px;
}

// Relevant styles
.image-stack {
  position: relative;
  width: 100%;
}

.image-stack__item--bottom {
  position: absolute;
  right: 0;
  top: 0;
  width: 80%; // this is an arbitrary width, depends on the design
  z-index: -1;
}

.image-stack__item--top {
  padding-top: 20px; // arbitrary value
  padding-right: 20%; // arbitrary value
  width: 80%; // arbitrary value
}

img {
  width: 100%;
  display: block;
}
              
            
!

JS

              
                
              
            
!
999px

Console