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

              
                .page-layer
  header.bookend
    a {
      href="https://codepen.io/collection/ABpRqv/" target="_blank" 
      data-tooltip-text="A side project" 
      data-tooltip-pos="bottom"}
      ' mui · Minimalist User Interface
    input#toggle-ui type="checkbox" checked=true
    label {for="toggle-ui" 
      data-tooltip-text="Default UI / Dark UI" 
      data-tooltip-pos="bottom align-right"}
      div
        svg.icon-light
      div
        svg.icon-dark
  main
    .exploder
      .component
        input#toggle-projection type="checkbox" checked=true
        label {
          for="toggle-projection" 
          data-tooltip-text="Explode on hover / Lock normal view" 
          data-tooltip-pos="top align-left"}
          div
            svg.icon-iso
          div
            svg.icon-ortho-lock
        .graphics    
          .viewport
            .progress-project
              .dates
                .start.label Jan 2016
                .finish.label Oct 2018
              .durations
                .to-completion.label 144 wks
                .to-date.label wk 104
              .bar
                .phase.phase-1 data-phase="Phase 1" style="width: 10%" title="More phase info"
                .phase.phase-2 data-phase="Phase 2" style="width: 25%" title="More phase info"
                .phase.phase-3 data-phase="Phase 3" style="width: 30%" title="More phase info"
                .phase.phase-4 data-phase="Phase 4" style="width: 30%" title="More phase info"
                .remaining style="padding-left:72%"
                .current-state.label.phase-4 style="width:72%" Phase 4 
          .annotation.left   
            .note.upward style="bottom:188px;padding-right:36px" 
              | Theme aware masking border. Psuedo element of .bar below. Mask used on oversized rectangular elements to prevent undesirable anti-aliasing of multiple overlapping elements below
            .note.upward style="bottom:101px;padding-right:60px" 
              | Theme aware phase end dots. Psuedo elements of phases. Key to visualising phase durations in future
            .note.upward style="bottom:6px;padding-right:32px" 
              | Base elements with graphic augmentation on hover (intersecting borders used to make arrows and ticks)
          .annotation.right    
            .note.upward style="bottom:279px;padding-left:30px" 
              | Absolutely positioned progress remaining element. Left padding via inline style reveals colored progress elements below
            .note style="top:99px;padding-left:118px" 
              | Curved border psuedo element to simulate border-radius on elements below
            .note style="top:156px;padding-left:62px" 
              | Optional phases laid out as flex items of bar element below. Hover triggers psuedo element phase label (using data attribute for content). Hover also hides sibling current phase/state label
            .note style="bottom:64px;padding-left:180px" 
              | box-shadow. Nothing to do with timeline component — just looks nice for isometric
        p.title 
          '  Progress bar kit
          span.secondary · Project timeline component

  footer.bookend
    span
    span.secondary
      a href="https://codepen.io/scootman/pen/yzRqzV" target="_blank" Complete Progress bar kit 
              
            
!

CSS

              
                // December 2021 update: Chrome no longer likes stacking translateZs :(

// My first serious foray into CSS 3D transforms
// Try in Dark UI mode (toggle top right)

// Also an example of melding several of my WIP UI kits:
// https://codepen.io/collection/ABpRqv/


// Variables

$exploder-viewport-width: 360px;
$exploder-viewport-height: 360px;
$exploder-annotation-width: 180px;
$exploder-viewport-annotation-gap: 16px;
$exploder-component-gap-v:$layout-gap-default;
$exploder-duration: .5s;


// Selectors

main {
  align-items:center;
}

.exploder {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  margin:-($exploder-component-gap-v/2) 0;
  padding:0 ($exploder-annotation-width/2 + $exploder-viewport-annotation-gap);
  flex:0 100%;
  
  .component {
    margin:($exploder-component-gap-v/2) ($exploder-annotation-width/2 + $exploder-viewport-annotation-gap);
    flex:0 0 $exploder-viewport-width;
    position:relative;
    label {
      position:absolute;
      left:0;
      top:0;
      z-index:100;
      opacity:0;
      @include transitionDefault('opacity');
    }
  }
  .component:hover label {
    opacity:1;
  }
  .component:hover input:checked + label {
    transition-delay:$exploder-duration + .15s;
  }
  .graphics {
    position:relative;
    display:flex;
  }
  .viewport {
    height:$exploder-viewport-height;
    flex:1 0px;
    order:2;
    display:flex;
    align-items:center;
    justify-content:space-around;
    > * {
      transition:transform $exploder-duration ease-in-out;
    }
  }
  input:checked ~ .graphics .viewport:hover > *, input:checked + label:hover + .graphics .viewport > * {
    transform:rotateX(60deg) rotateZ(-45deg) scale(1.25) translateZ(-96px);
    .bar {
      transition-delay: .25s;
      box-shadow:-40px 40px 40px hsla(0,0,0,.20);
      .dark-ui & {
        box-shadow:-40px 40px 40px hsla(0,0,0,.7);
      }
    }
    .bar::after {
      transform:translateZ(196px);
    }
    .remaining {
      transform:translateZ(128px);
      transform-style:preserve-3d;
      overflow:visible;
      &::before {
        transform:translateZ(24px);
      }
    }
    .phase,.current-state {
      transform:translateZ(64px); 
      transform-style:preserve-3d;
    }
    .phase::after {
      transform:translateZ(24px);
      box-shadow:0px 0px 5px black;
      .dark-ui & {
        box-shadow:0px 0px 5px white;
      }
    }
  }
  
  .annotation {
    opacity:0;
    flex:0 0px;
    position:relative;
    font-size:14px;
    color:$color-secondary;
    transition:all .35s ease-in-out;
    pointer-events:none;
    &.left {
      order:1;
      .note {
        left:-($exploder-annotation-width + $exploder-viewport-annotation-gap);
        justify-content:flex-end;
        text-align:right;
        &::before {
          right:0;
          left:($exploder-annotation-width + $exploder-viewport-annotation-gap/2);  
        }
      }
    }
    &.right {
      order:3;
      .note {
        right:-($exploder-annotation-width + $exploder-viewport-annotation-gap);
      }
    }
  }
  input:checked ~ .graphics .viewport:hover ~ .annotation, input:checked + label:hover + .graphics .annotation {
    opacity:1;
    transition-delay:$exploder-duration + .15s;
  }
  .note {
    position:absolute;
    box-sizing:content-box;
    display:flex;
    width:$exploder-annotation-width;
    height:1em;
    margin-top:-.6em;
    line-height:1.2em;
    z-index:99;
    &.upward {
      align-items:flex-end;
      &::before {
        bottom:0;
      }
    }
    &::before {
      content:"";
      box-sizing:content-box;
      position:absolute;
      padding:.6em 0 calc(.6em - 1px);
      height:1px;
      background-clip:content-box;
      background-color:currentColor;
      left:0;
      right:($exploder-annotation-width + $exploder-viewport-annotation-gap/2);
    }
  }
}


.progress-project {
  width:100%;
  transition:transform .5s ease-in-out;
  transform-style:preserve-3d;
  .phase, .remaining, .current-state {
    transition:transform .5s ease-in-out;
  }
  .bar {
    transition:all .25s ease-in-out;
    background-image:none;
  }
  .phase::after, .bar::after { 
    transition:all .5s ease-in-out;
    // 'all' was a happy accident for the ui theme aware elements. Makes a nice effect when you toggle between ui modes
  }
}

header {
  padding:20px 24px 32px;
}


footer {
  padding:32px 24px 20px;
  font-size:14px;
}

              
            
!

JS

              
                // UI theme toggle (adds .dark-ui class to .page-layer). 
// View projection toggle doesn't use JS - it relies on the :checked psuedo class

$('#toggle-ui').click(function() {
  $('.page-layer').toggleClass( "dark-ui" )
});

// SVGInjector2 for insertion of SVG icon assets

(function(window, document){
    // Options
    var injectorOptions = {
      evalScripts: 'once',
      spritesheetURL: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/436544/mui-assets.svg',
      spriteClassIdName: 'icon-'
    };
    // Setup the injector
    var injector = new SVGInjector(injectorOptions);
    // inject single svg
    injector.inject(document.querySelectorAll('svg[data-src]'));
    // inject svgs from spritesheets
    injector.inject(document.querySelectorAll('svg[class^=icon-]'));
  })(window, document); 
              
            
!
999px

Console