cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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>
  <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>
            
          
!
            
              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;
  }
}
            
          
!
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