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>
  <body>
    <!-- Codepen example, by Michael Fosgerau -->
    <!-- Based on effect on http://blender.org (2018-03) -->
    <!-- Free image used in this example is from https://pixabay.com/da/baggrund-terninger-valg-en-bl%C3%A5-2492010/ -->
    <div class="container">
      <div class="topdiv">
        <h1>Slanted &lt;div&gt; layout</h1>
        <b>This is the top div.</b>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
      </div>
    </div>
    <div class="container">
      <div class="imagebg"></div>
      <div class="middleoverlay"></div>
      <div class="topoverlay"></div>
      <div class="middlediv">
        <div class="rightbox">
          <b>This is the middle div.</b>
          Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        </div>
      </div>
      <div class="topoverlay type2"></div>
    </div>
    <div class="bottomdiv">
      <b>This is the bottom div.</b>
      Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>
  </body>
</html>
              
            
!

CSS

              
                html, body {
  font-family: segoe ui;
  font-size: 7pt;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  background: #aaa;
}
.topdiv {
  height: 240px;
  display: block;
  background-color: #000;
  color: #ddd;
  padding-top: 25px; 
  text-align: center;
      box-sizing: border-box;
  padding-left: 10%;
  padding-right: 10%;
}
.topoverlay {
  
  background-image: linear-gradient(2deg, transparent 49%, #000 50%);
  height: 50px;
  left: 0;
  position: relative;
  right: 0;
  top: 0;
  z-index: 0;
      box-sizing: border-box;
}
.middlediv {
  height: 200px;
  color: #000;
  padding-top: 65px; 
  text-align: center;
  z-index: 2;
}
.middleoverlay {
  background-color: #ddd;
  bottom: -100%;
  left: 50%;
  position: absolute;
  right: 0%;
  top: -50%;
  transform: rotate(15deg);
  border:5px solid #red;
}
.container {
  overflow: hidden;
      background-color: #fff;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
    -ms-flex-pack: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
      box-sizing: border-box;
}
.type2 {
  background-image: linear-gradient(-2deg, #aaa 49%, transparent 50%);
  top: initial;
  bottom: 0;
}
.bottomdiv {
  background-color: #aaa;
  height: 200px;
  display: block;
  color: #333;
  padding-top: 65px; 
  text-align: left;
  box-sizing: border-box;
  padding-left: 10%;
  padding-right: 10%;
}
.rightbox {
  margin-left: 50%;
  padding-left: 10%;
  padding-right: 10%;
  text-align: left;
}
.imagebg {
  background-image:url('https://i.imgur.com/9JeuAuJ.jpg');
  background-color: #fff;
  background-position: center center;
  background-size: 60%;
  bottom: 0;
  left: -280px;
  position: absolute;
  right: 0;
  top: 0;
  color: #fff;
}

@media (min-width: 768px)
{
  body {
    font-size: 9pt;
  }
}

@media (min-width: 992px)
{
  body {
    font-size: 12pt;
  }
}

@media (min-width: 1200px)
{
  body {
    font-size: 14pt;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console