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

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.

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 id="page">
  <div class="shadow-wrapper">
    <div class="shadow">
      <div>&nbsp;</div>
    </div>
  </div>
  <div class="box-wrapper">
    <div class="box">
      <div class="front face"></div>
      <div class="top">&nbsp;</div>
      <div class="bottom">&nbsp;</div>
      <div class="right face"></div>
      <div class="back face"></div>
      <div class="left face"></div>
    </div><!-- end of .box -->
  </div><!-- end of .box-wrapper -->
</div><!-- end of #page -->

<div class="overflow-container">
  <div class="meta">(Text that won't fit in the cube flows here)</div>
  <div class="overflow face">
  </div>
</div>

<div class="instructions">
    This demo is for my <a target="_blank" href="http://fonicmonkey.net/2013/09/23/combining-css-regions-with-transforms-and-animations/">blog post about CSS regions &amp; animation</a>.
  <br/><br/>
  NOTE: A browser with <a target="_blank" href="http://fonicmonkey.net/2013/09/09/css-regions-and-why-youll-be-using-them-before-you-know-it/#browsersupport">support for CSS Regions</a> is required. 
</div>

<div class="content">
  <strong>Hello and welcome</strong> to a CSS regions example.
  <p>
  I'm <a target="_blank" href="http://fonicmonkey.net/">Lee Mallabone</a> and I created this demo as a fun example of what happens when you combine CSS regions with transforms and animation.
  <p>
    Thanks to <a href="https://codepen.io/cliffpyles/pen/LHlqa">Cliff Pyles</a> and <a href="http://davidwalsh.name/css-cube">David Walsh</a> for the gorgeous CSS cube that's spinning here.
  <p>
    To see the region support really shine, have a look at the CSS section in the codepen editor and update the <tt>$cube-size</tt> variable. Try changing it to something like 280px and watch how the text flows differently (but appropriately) into the cube faces.
    
    <p>
      Change the font-size on the body style block too, and see how everything still flows across each cube face regardless of spacing, line breaks or paragraphs.
      <p>

What now follows is some boilerplate text to allow the prose to flow downwards into the overflow div I've created below.

<p>    
    2.3. Named flows

A named flow is the ordered sequence of content associated with a flow with a given identifier. Contents in a named flow are ordered according to the document order.

Content is placed into a named flow with the ‘flow-into’ property. The content in a named flow is laid out in the region chain that is associated with this named flow using the ‘flow-from’ property.

Content from a named flow is broken up between regions according to the regions flow breaking rules.

A named flow is created when some content is moved into the flow with the given identifier or when at least one CSS Region requests content from that flow.

2.4 
</div>
              
            
!

CSS

              
                @import "compass/css3";

$cube-size: 220px;

.box, .shadow {
  -webkit-animation: spin 45s infinite linear;
}

body {
  background-color: #333;
  font-family: Optima, Helvetica;
  font-size: 18px;
}

.content {
  -webkit-flow-into: myipsum;
  flow-into: myipsum;
}

.face {
  -webkit-flow-from: myipsum;
  flow-from: myipsum;
  box-sizing: border-box;
  padding: 18px;
}

.overflow-container {
  width: 90%;
  height: 200px;
  position: absolute;
  top: $cube-size + 150px;
  margin-left: 20px;
  color: black;
  background-color: #ccc;
  padding: 25px;
  box-shadow: inset 0 0 100px #666;
  overflow: scroll;
  .meta {
    position: absolute;
    right: 0;
    top: 0;
    padding: 5px 8px;
    color: #ddd;
    background-color: green;
  }
  .face {
    opacity: .7;
  }
}

.instructions {
  position: absolute;
  width: 120px;
  padding: 10px;
  right: 0;
  top: 0;
  font-size: 12px;
  background-color: white;
}

#page {
  position: absolute;
  text-align: center;
  left: 35%;
  top: 50px;
  color: #222;
}

.box-wrapper {
  perspective: 800px;
  perspective-origin: 50% 100px;
}

.box {
  position: relative;
  width: $cube-size;
  transform-style: preserve-3d;
}
.box p {
  padding: 40px 0;
}
.box div {
  outline: 1px solid #999;
  position: absolute;
  width: $cube-size;
  height: $cube-size;
  opacity: 0.98;
  box-shadow: inset 0px 0px ($cube-size / 2) #555;
}

.back {
  transform: translateZ(-$cube-size / 2) rotateY(180deg);
  background-color: #eee;
}
.right {
  transform: rotateY(-270deg) translateX($cube-size / 2);
  transform-origin: top right;
  background-color: #ddd;
}
.left {
  transform: rotateY(270deg) translateX(-$cube-size / 2);
  transform-origin: center left;
  background-color: #ddd;
}
.top {
  transform: rotateX(-90deg) translateY(-$cube-size / 2);
  transform-origin: top center;
  background-color: #fafafa;
}
.bottom {
  transform: rotateX(90deg) translateY($cube-size / 2);
  transform-origin: bottom center;
  background-color: #bbb;
}
.front {
  transform: translateZ($cube-size / 2);
  background-color: #eee;
}


@keyframes spin {
  from { transform: rotateY(360deg); }
  to { transform: rotateY(0); }
}

.left p { color: #27a05c; }
.right p { color: #27a05c; }
.front p { color: #27a05c; }
.back p { color: #27a05c; }

.shadow-wrapper {
  perspective: 800px;
  perspective-origin: 50% $cube-size / 2;
/*  -webkit-perspective: 800px;
  -webkit-perspective-origin: 50% 100px;*/
}

.shadow {
  position: relative;
  width: $cube-size;
  transform-style: preserve-3d;
  div {
    position: absolute;
    width: $cube-size;
    height: $cube-size;
    top: 2px;
    opacity: 0.98;
    box-shadow: 0px 0px $cube-size / 2 #000;
    transform: rotateX(90deg) translateY($cube-size / 2);
    transform-origin: bottom center;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console