octocatstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

            
              <!--
See my REMux collection for more examples:
http://codepen.io/collection/nDhkf

REMux is an idea I had while reading some articles about REM units and screen real estate usage beyond 960px. Basically REMux is able to scale a layout to fit the available screen real estate within the boundaries of one or numerous layouts (and their breakpoints respectively). So within a single layout there is no re-ordering of elements, jerky changes in proportions etc.

REMux consists of two things:
1. Use only REM as unit in your CSS
2. A small javascript class that handles the initialization of layouts and handles everything else.

The javascript does not depend on jQuery - I only included it for convenience for the info panel.

See it in action on my personal website (work in progress):
=> http://www.qoopido.com

REMux is part of the GitHub repository for all my Javascripts, so source code is available under:
=> https://github.com/dlueth/qoopido.js/blob/master/src/remux.js
-->
<div id="panel">
  <dl>
    <dt>width:</dt>
    <dd class="width"></dd>
    <dt>font-size:</dt>
    <dd class="fontsize"></dd>
    <dt>layout:</dt>
    <dd class="layout"></dd>
  </dl>
</div>
<section>
  <div>
    <div class="small">1</div>
    <div class="medium">2</div>
    <div class="large">3</div>
    <div class="medium">4</div>
    <div class="small">5</div>
  </div>
</section>
            
          
!
            
              /******************
* Layout specific
*******************/
@media screen and (max-width: 699px) {
  body {
    min-width: 30rem;
    width: auto !important;
    width: 30rem;
    padding: 1rem;
    
    > section {
      width: 28rem; // (420px - (2 * 14px)) / 14px;
      
      > div {
        width: 29rem;
        
        > div {
          width: 28rem;
        }
      }
    }
  }
}

@media screen and (min-width: 700px) {
  body {
    min-width: 70rem;
    width: auto !important;
    width: 70rem;
    padding: 2rem;
    
    > section {
      width: 66rem; // (980px - (2 * 28px)) / 14px;
        
      > div {
        width: 67rem;
        
        > div {
          height: 20rem;
          
          &.small {
            width: 20rem;
          }
        
          &.medium {
            width: 45rem;
          }
        
          &.large {
            width: 66rem;
          }
        }
      }
    }
  }
}

/******************
* Basic CSS
*******************/
* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  background-color: #333;
  color: #fff;
  text-align: center;
  
  > section {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    font-size: 0;

    > div {
      > div {
        display: inline-block;
        margin: 0 1rem 1rem 0;
        background-color: #666;
        font-size: 10rem;
        line-height: 20rem;
      }
    }
  }
}

#panel {
  z-index: 1;
  position: fixed;
  left: 10px;
  top: 10px;
  padding: 10px;
  background-color: fade(#fff, 25%);
  font-size: 14px;
  line-height: 21px;
  color: #000;
  border-radius: 8px;
  
  dl {
    margin: 0;
    padding: 0;
    
    dt, dd {
      float: left;
      margin: 0;
      padding: 0;
      text-align: left;
    }
    
    dt {
      width: 76px;
      font-weight: bold;
    }
    
    dd + dt {
      clear: both;
    }
  }
}
            
          
!
            
              // initialize REMux (no jQuery dependency)
var remux = window.qoopido.remux
    .addLayout({
      mobile: { width: 420, base: 14, min: 10, max: 23, breakpoint: 420 * (10 / 14) },
      desktop: { width: 980, base: 14, min: 10, max: 18, breakpoint: 980 * (10 / 14) }
    });

// Code for the info panel
var $window   = $(window),
    $panel    = $('#panel'),
    $width    = $('.width', $panel),
    $fontsize = $('.fontsize', $panel),
    $layout   = $('.layout', $panel),
    state     = remux.getState();

$width.html(state.width + 'px');
$fontsize.html(state.size.zoomed + 'px');
$layout.html(state.layout);

remux.on('ratiochange', function(state) {
  $width.html(state.width + 'px');
  $fontsize.html(state.size.zoomed + 'px');
});

remux.on('layoutchange', function(state) {
  $layout.html(state.layout);
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console