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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

              <div class="one">
  level one
  <div class="two">
    level two
    <div class="three">
      level three
      <div class="level-up">
        Go one level up
      <div class="inception">
        Context from three levels deep.

              @import "compass/css3";

// simple function to find the context of a nested percentage.
@function nested-context($contexts) {
  // First level deep is always 100%
  $percentage: 100%;
  // Loop through each level
  @each $context in $contexts {
    // Invert the percentage to find context
    $percentage: percentage($percentage / $context);
  // Return final percentage
  @return $percentage;

// mixin to make things easier
@mixin nested-context($contexts, $position: left) {
  width: nested-context($contexts);
  @if $position == "center" {
    position: relative;
    left: 50%;
    margin-left: nested-context($contexts) * -.5;
  @if $position == "right" {
    margin-left: nested-context($contexts) * -1 + 100%;

// Find the context of percentage widths from deeply nested containers.

.level-up {
  @include nested-context(28%);
  background: blue;

.inception {
  // list as many levels deep as you want
  width: nested-context(28% 63% 84%);
  background: red;

.one   { width: 84%; }
.two   { width: 63%; }
.three { width: 28%; }

.one, .two, .three {
  height: 100%;
  background: rgba(#FF9900, .2);

html, body {
  height: 100%;
Loading ..................