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 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.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <div class="layout-area" data-layout="fine">
  <div class="layout-select">
    <button class="layout-select-button layout-select-fine is-selected" data-value="fine" title="switch to fine layout"><i class="icon-th"></i></button><button class="layout-select-button layout-select-coarse" data-value="coarse" title="switch to coarse layout"><i class="icon-th-large"></i></button>
  <nav class="main-nav">
    <a>Nav 1</a><a>Nav 2</a><a>Nav 3</a><a>Nav 4</a>
    <h1>Coarse/Fine UI Toggle</h1>
    <p>Change the styling of the navigation above between fine / coarse accuracy using the toggle control.</p>
              html {
  padding: 0;
  margin: 0;
  background: #F4F4F4;
  font-family: Verdana, sans-serif;
  font-size: 14px;

.layout-area {
  margin: 10px 10px 20px;

.layout-select {
  text-align: right;
  margin-bottom: 20px;
.layout-select-button {
  position: relative;
  padding: 0.1em 0.4em;
  margin: 0;
  border: solid #AAA;
  background: #FFF;
  background-image: -moz-linear-gradient(-90deg, #FFF, #DDD);
  background-image: -o-linear-gradient(-90deg, #FFF, #DDD);
  background-image: -webkit-linear-gradient(-90deg, #FFF, #DDD);
  background-image: linear-gradient(180deg, #FFF, #DDD);
  font-size: 28px;
  color: #444;
  cursor: pointer;
  -moz-transition: all 0.1s;
  -o-transition: all 0.1s;
  -webkit-transition: all 0.1s;
  transition: all 0.1s;
.layout-select-fine {
  border-width: 1px 0 1px 1px;
  border-radius: 4px 0 0 4px;
.layout-select-coarse {
  border-width: 1px 1px 1px 0;
  border-radius: 0 4px 4px 0;
  margin-left: -1px;
.layout-select-button.is-selected {
  color: #FFF;
  border-color: #4071AD;
  background-color: #0391f0;
  background-image: #EEE -moz-linear-gradient(-90deg, #0391f0 10%, #0066aa);
  background-image: -o-linear-gradient(-90deg, #0391f0 10%, #0066aa);
  background-image: -webkit-linear-gradient(-90deg, #0391f0 10%, #0066aa);
  background-image: linear-gradient(180deg, #0391f0 10%, #0066aa);
  box-shadow: inset 0 0 5px #555;

.main-nav a {
  display: inline-block;
  border: solid #999;
  text-align: center;
  color: #198FDD;
  cursor: pointer;
  -moz-transition: all 0.2s;
  -o-transition: all 0.2s;
  -webkit-transition: all 0.2s;
  transition: all 0.2s;
[data-layout=fine] .main-nav a {
  width: 80px;
  padding: 0 0.2em;
  margin: 0 0 10px -1px;
  border-width: 0 1px;
  line-height: 20px;
[data-layout=fine] .main-nav a:hover {
  text-decoration: underline;
[data-layout=coarse] .main-nav a {
  width: 100px;
  margin: 0 10px 10px 0;
  border-width: 1px;
  border-radius: 4px;
  background: #FFF;
  line-height: 60px;
[data-layout=coarse] .main-nav a:active {
  background: #48C;
  color: #FFF;
  -moz-transition: none;
  -o-transition: none;
  -webkit-transition: none;
  transition: none;
.main-nav form {
  display: inline-block;
              $('.layout-select').on('click', '.layout-select-button', function () {
  var $this = $(this);
  if($this.not('.is-selected')) {
    $this.closest('.layout-area').attr('data-layout', $this.data('value'));

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.


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