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

              
                <div class="mm-menu">
  <a href="javascript:;" class="mm-item"><span class="fontawesome-home"></span></a>
  <a href="javascript:;" class="mm-item"><span class="fontawesome-comment"></span></a>
  <a href="javascript:;" class="mm-item"><span class="fontawesome-th"></span></a>
  <a href="javascript:;" class="mm-item"><span class="fontawesome-camera"></span></a>
  <a href="javascript:;" class="mm-item"><span class="fontawesome-cog"></span></a>
</div><!--/mm-menu-->
              
            
!

CSS

              
                @import "compass/css3";

@import url(http://weloveiconfonts.com/api/?family=fontawesome);

$mm-n: 5;
$mm-item-size: 4.5em;
$mm-menu-width: $mm-item-size * $mm-n;

$white: hsl(215, 18%, 97%);
$gray: hsl(215, 8%, 85%);
$slate: hsl(160, 6%, 78%);
$icon: hsl(0,0%,79%);

html,body { height:100%; position:relative }
body {
  margin: 0;
  background: radial-gradient(circle at 40% 0%,#eee 10%,#999);
}

.mm-menu {
  font-size: 1rem;
  position: relative;
  width: $mm-menu-width; height: $mm-item-size;
  border-radius: 0.15em;
  background: $slate;
  box-shadow:
    0 -1px 0.3em rgba(#002,.2) inset,
    0 -1px 1px rgba(#002,.03) inset,
    2px 2px 3px rgba(#002,.2);
// Screen Centering:
  margin: ($mm-item-size / -2) auto 0;
  top: 50%;
}

.mm-item > [class*="fontawesome-"]::before {
  display: block;
  font-family: 'FontAwesome';
  font-size: 2em;
  text-align: center; line-height: $mm-item-size / 2;
  color: $icon;
  text-shadow:
    0 -0.03em rgba(#000,.21),
    0 0.03em 0.06em rgba(#fff,.5);
}

.mm-item {
  @include box-sizing(border-box);
  display: block; position: relative;
  top: -0.25em; float: left;
  width: $mm-item-size; height: $mm-item-size;
  text-decoration: none;
  border-radius: 0.15em;
  transition: 250ms;
  background: linear-gradient($white,$gray) 0 50%;
  background-size: 100% 200%;
}

.mm-item:hover {
  top: -0.35em;
  background-position: 0 0%;
}

.mm-item:focus,
.mm-item:active {
  outline: none;
  top: -0.15em;
  background-position: 0 100%;
}

.mm-item,
.mm-item:first-of-type:focus,
.mm-item:first-of-type:active,
.mm-item:hover:focus + .mm-item,
.mm-item:hover:active + .mm-item {
  box-shadow:
    1px 1px 0 0 rgba(#fff,.15) inset,
    0 0 0 0 rgba(#000,0) inset,
    0.2em 0.2em 0.3em -0.07em rgba(#fff,.6) inset,
    -0.2em -0.3em 0.3em -0.07em rgba(#000,.08) inset;
} 

.mm-item:hover + .mm-item,
.mm-item:focus,
.mm-item:active {
  box-shadow:
    0 0.3em 0.3em -0.2em rgba(#fff,.6) inset,
    1px 0 0 0 rgba(#000,.02) inset,
    0.35em 0 0.3em -0.2em rgba(#002,.07) inset,
    -0.2em -0.3em 0.3em -0.07em rgba(#000,.08) inset;
}

.mm-item:hover + .mm-item:focus {
  box-shadow:
    0 0.3em 0.3em -0.2em rgba(#fff,.6) inset,
    1px 0 0 0 rgba(#000,.01) inset,
    0.45em 0 0.3em -0.2em rgba(#002,.09) inset,
    -0.2em -0.3em 0.3em -0.07em rgba(#000,.08) inset;
}


// ******************************* //
// The following code is simply a technique I just came up with which uses a media query to specifically style certain elements differently when it is in the Codepen preview mode.
// In this case I use it to increase the overall size of the UI Bar, add the hover state effect to the 1st button, and add the pressed effect to the 3rd button.

@media only screen and (height: 300px) {
  .mm-menu { font-size:1.5rem }
  .mm-item:nth-of-type(1) {
    top: -0.35em;
    background-position: 0 0%;
    &::after { top:$mm-item-size + 0.3em }
  }
  .mm-item:nth-of-type(2) {
    box-shadow:
      0 0.2em 0.3em -2px rgba(#fff,.6) inset,
      -1px -1px 0 0 rgba(#000,.03) inset,
      0.3em 0 0.2em -2px rgba(#000,.05) inset,
      -0.2em -0.2em 0.3em -2px rgba(#000,.08) inset;
  }
  .mm-item:nth-of-type(3) {
    top: -0.15em;
    background-position: 0 100%;
    box-shadow:
      0 0.2em 0.3em -2px rgba(#fff,.6) inset,
      -1px -1px 0 0 rgba(#000,.03) inset,
      0.3em 0 0.2em -2px rgba(#000,.05) inset,
      -0.2em -0.2em 0.3em -2px rgba(#000,.08) inset;
    &::after { top:$mm-item-size + 0.1em }
  }
  .mm-item:last-of-type::before { width:43.4% }
}
              
            
!

JS

              
                // JS needed to simulate the "sticky" focus state, aka stay pressed down, in chrome:

$(".mm-item").click(function() {
  $(this).focus();
});
              
            
!
999px

Console