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.

            
              <header>
  
  <h1>Pattern Library</h1>
  
  <nav>
    <ul>
      <li>
        <a class="home" href="#">
          <i class="icon-home"></i>
        </a>
      </li>
      <li>
        <a class="edit" href="#">
          <i class="icon-pencil"></i>
        </a>
      </li>
      <li>
        <a class="menu" href="#">
          <i class="icon-reorder"></i>
        </a>
      </li>
    </ul>
  </nav>
  
</header>

<article>
  
  <div class="section pattern">
    <a class="nav" href="#">
      <i class="icon-th-large"></i>
    </a>
    
    <h1>
      Pattern Name
      <span>
        Version #2. 
        Updated 2012-01-11 at 1:52PM.
        <a href="#">Permalink</a>
      </span>
    </h1>
    <p class="category">
      <a href="#">Pattern Category</a> >  <a href="#">Pattern Sub Category</a>
    </p>
    
  </div>
  
  
  <div class="section output">
    <a class="nav" href="#">
      <i class="icon-picture"></i>
    </a>
    <div class="display"></div>
  </div>
  
  <div class="section markup collapse">
    
    <a class="nav" href="#">
      <i class="icon-quote-left"></i>
    </a>
    
    <div class="type html">
      <h2 class="on">HTML</h2>
      <p class="status">Updating</p>
      <textarea class="code"><label for="search">Search</label>
<input type="text" id="search" />
<button>Go</button></textarea>
    </div>
    
    <div class="type css">
      <h2>CSS</h2>
      <p class="status">Updating</p>
      <textarea class="code">label {
  font-weight: bold;
}</textarea>
    </div>
    
    <div class="type js">
      <h2>JS</h2>
      <p class="status">Updating</p>
      <textarea class="code">console.log('foo');</textarea>
    </div>
    
  </div>
  
  <div class="section notes">
    
    <a class="nav" href="#">
      <i class="icon-file-alt"></i>
    </a>
    
    <h1>Pattern Notes</h1>
    <p>
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem.
    </p>
    
  </div>
  
</article>

<aside>

  <nav>
    <ul>
      <li>
        <a href="#">Pattern name</a>
      </li>
      <li>
        <a href="#">Pattern name</a>
      </li>
      <li>
        <a href="#">Pattern name</a>
      </li>
      <li>
        <a href="#">Pattern name</a>
      </li>
      <li>
        <a href="#">Pattern name</a>
      </li>
      <li>
        <a href="#">Pattern name</a>
      </li>
      <li>
        <a href="#">Pattern name</a>
      </li>
      <li>
        <a href="#">Pattern name</a>
      </li>
      <li>
        <a href="#">Pattern name</a>
      </li>
    </ul>
  </nav>
  
</aside>
            
          
!
            
              @import "compass/css3";

@import "compass/reset";
@import "compass/utilities/general/clearfix";

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);

$img-background-light: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="4" height="4" viewBox="0 0 4 4"%3E%3Cpath fill="%23bbbbbb" fill-opacity="0.4" d="M1 3h1v1H1V3zm2-2h1v1H3V1z"%3E%3C/path%3E%3C/svg%3E');
$img-background-dark: #444 url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23111111' fill-opacity='0.3' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");

$clr-background: #f3f3f3;
$clr-text: #383838;
$clr-link: lighten($clr-text, 20);
$clr-pattern: #fbb018;
$clr-output: #74be46;
$clr-markup: #00a6c7;
$clr-markup-html: desaturate($clr-markup, 60);
$clr-markup-css: lighten(saturate(adjust-hue($clr-markup-html, 25), 20), 10);
$clr-markup-js: adjust-hue($clr-markup-css, 25);
$clr-notes: #f48134;


body {
  @include background($clr-background $img-background-light repeat left top);
  color: $clr-text;
  font: normal 1em/1.5em 'Open Sans', arial, sans-serif;
}

a {
  color: $clr-link;
  text-decoration: none;
  
  &:hover {
    color: darken($clr-link, 20);
    text-decoration: underline;
  }
  
}

h1 {
  
  color: lighten($clr-text, 20);
  font-size: 1.5em;
  padding: 10px 10px 0 10px;
  
  span {
    float: right;
    font-size: 0.5em;
  }
  
}

h2 {
  font-size: 0.8em;
  font-weight: bold;
}

p {
  padding: 10px;
}

header {
  
  @include background($img-background-dark repeat left top);
  height: 30px;
  
  h1 {
    
    color: lighten($clr-text, 40);
    font-size: 0.8em;
    margin: 0;
    padding: 0 0 0 42px;
    
    &:before {
      
      @include background(darken($clr-text, 6));
      content: '';
      display: block;
      height: 30px;
      left: 0;
      position: absolute;
      width: 30px;
      
    }
    
  }
  
  nav {
    
    position: absolute;
    right: 10px;
    top: 0;
    
    ul li {
      
      float: left;
      font-size: 1.2em;
      margin: 0 0 0 10px;
      
      a {
        
        color: lighten($clr-text, 40);
        display: block;
        height: 30px;
        text-align: center;
        width: 40px;
        
        &:hover {
          
          background: darken($clr-text, 5);
          color: lighten($clr-text, 50);
          text-decoration: none;
          
        }
        
        &.on {
          background: darken($clr-text, 8);
          color: lighten($clr-text, 40);
        }
        
      }
      
    }
    
  }
  
}

article {
  
}

.nav {
  
  background: $clr-text;
  bottom: 0;
  color: $clr-background;
  display: block;
  left: 0;
  padding: 4px 0 0 6px;
  position: absolute;
  width: 24px;
  top: 0;
  
  &:hover {
    text-decoration: none;
  }
  
}

.section {
  
  padding-left: 30px;
  position: relative;
  
  &.collapse {
    
    @include background($clr-background $img-background-light repeat left top);
    @include box-shadow(0 0 0 $clr-background);
    height: 30px;
    padding: 0;
    
    div, h1, p {
      display: none;
    }
    
  }
  
}

.pattern {
  
  .nav {
    
    @include background(linear-gradient(left, $clr-pattern, lighten($clr-pattern, 20)));
    color: darken($clr-pattern, 15);
    
    &:hover {
      background: $clr-pattern;
      color: darken($clr-pattern, 20);
    }
    
  }
  
  h1 {
    color: darken($clr-pattern, 20);
  }
  
  .category {
    font-size: 0.9em;
    padding-top: 0;
  }
  
  &.collapse {
      
    h1 {
      
      display: block;
      font-size: 0.9em;
      padding: 2px 10px 0 40px;
      
      span {
        font-size: 1em;
      }
      
    }
      
  }
  
}

.output {
  
  background: $clr-background;
  box-shadow: inset 0 0 30px darken($clr-background, 20);
  margin-bottom: 0;
  padding: 20px 40px;
  
  .nav {
    
    @include background(linear-gradient(left, $clr-output, lighten($clr-output, 20)));
    color: darken($clr-output, 10);
    
    &:hover {
      background: $clr-output;
      color: darken($clr-output, 20);
    }
    
  }
  
  .display {
    @include global-reset;
  }
  
}

.markup {
  
  @include clearfix;
  height: 180px;
  pointer-events: none;
  
  .nav {
    
    @include background(linear-gradient(left, $clr-markup, lighten($clr-markup, 20)));
    color: darken($clr-markup, 10);
    pointer-events: all;
    
    &:hover {
      background: $clr-markup;
      color: darken($clr-markup, 20);
    }
    
  }
  
  .status {
    float: right;
    font-size: 0.7em;
    margin: 0 10px 0 0;
    opacity: 0;
    padding: 0;
  }
  
  .type {
  
    margin: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
    width: 100%;
    
    h2 {
      
      cursor: pointer;
      float: left;
      padding: 0 10px;
      pointer-events: all;
      text-align: center;
      width: 40px;
      
    }
    
    &:first-child {
      margin-left: 10px;
    }
    
    .code {
      
      border: 0;
      font-family: consolas, 'courier new', georgia, sans-seif;
      height: 134px;
      left: 0;
      margin: 0;
      padding: 10px;
      pointer-events: all;
      position: absolute;
      top: 24px;
      right: 30px;
      
      &:focus {
        
        outline: 0;
        
      }
      
    }
    
    &.html {
      
      h2 {
        
        @include background(linear-gradient(left, lighten($clr-markup-html, 20), lighten($clr-markup-html, 30)));
        color: $clr-markup-html;
        
        &.on {
          
          @include background(linear-gradient(left, $clr-markup-html, lighten($clr-markup-html, 10)));
          color: lighten($clr-markup-html, 50);
          
        }
        
      }
      
      .code {
        
        @include background(linear-gradient(left, darken($clr-markup-html, 25) 30%, darken($clr-markup-html, 15)));
        border-top: solid 3px $clr-markup-html;
        color: lighten($clr-markup-html, 20);
        pointer-events: all;
        
      }
      
    }
    
    &.css {
      
      h2 {
        
        @include background(linear-gradient(left, lighten($clr-markup-css, 20), lighten($clr-markup-css, 30)));
        color: $clr-markup-css;
        margin-left: 61px;
        
        &.on {
          
          @include background(linear-gradient(left, $clr-markup-css, lighten($clr-markup-css, 10)));
          color: lighten($clr-markup-css, 50);
          
        }
        
      }
      
      .code {
        
        @include background(linear-gradient(left, darken($clr-markup-css, 30) 30%, darken($clr-markup-css, 15)));
        border-top: solid 3px $clr-markup-css;
        display: none;
        color: lighten($clr-markup-css, 20);
        
      }
    }
    
    &.js {
      
      h2 {
        
        @include background(linear-gradient(left, lighten($clr-markup-js, 20), lighten($clr-markup-js, 30)));
        color: $clr-markup-js;
        margin-left: 122px;
        
        &.on {
          
          @include background(linear-gradient(left, $clr-markup-js, lighten($clr-markup-js, 10)));
          color: lighten($clr-markup-js, 50);
          
        }
        
      }
      
      .code {
        
        @include background(linear-gradient(left, darken($clr-markup-js, 30) 30%, darken($clr-markup-js, 20)));
        border-top: solid 3px $clr-markup-js;
        display: none;
        color: lighten($clr-markup-js, 30);
        
      }
      
    }
    
  }
  
}

.notes {
  
  .nav {
    
    @include background(linear-gradient(left, $clr-notes, lighten($clr-notes, 20)));
    color: darken($clr-notes, 15);
    
    &:hover {
      background: $clr-notes;
      color: darken($clr-notes, 25);
    }
    
  }
  
  h1 {
    color: darken($clr-notes, 20);
  }
  
}

aside {
  
  @include background(darken($clr-text, 8));
  @include box-shadow(0 5px 20px $clr-text);
  color: $clr-background;
  display: none;
  font-size: 0.9em;
  position: absolute;
  right: 0;
  top: 30px;
  width: 200px;
  z-index: 500;
  
  nav {
    
    a {
      
      border-bottom: solid 1px $clr-text;
      color: lighten($clr-text, 50);
      display: block;
      padding: 5px 10px;
      
      &:hover {
        background: darken($clr-text, 12);
        color: lighten($clr-text, 40);
        text-decoration: none;
      }
      
    }
    
  }
  
}


            
          
!
            
              var UpdateOutput = function (html, css, js, source) {
  
      if (source) {
         ShowUpdateIndicator(source);
      }
  
      $('.output .display').html();
      $('.output .display').html('<style type="text/css">' + css + '</style>' + html);
  
    },
    
    ShowUpdateIndicator = function (source) {
      
      var item = source.prev('.status');
      
      item.animate({opacity: 1}, 500, 'linear').animate({opacity: 0}, 200, 'linear');
      
    },
    
    patternHtml = $('.html .code').val(),
    patternCss = $('.css .code').val(),
    patternJs = $('.js .code').val();


UpdateOutput(patternHtml, patternCss, patternJs);


$('.html .code').keydown(function () {
  
  patternHtml = $(this).val(); 
  UpdateOutput(patternHtml, patternCss, patternJs, $(this));
  
});


$('.css .code').keydown(function () {
  
  patternCss = $(this).val();
  UpdateOutput(patternHtml, patternCss, patternJs, $(this));
  
});


$('.type h2').click(function () {
  
  $('.type .code').hide();
  $('.type h2').removeClass('on');
  $(this).addClass('on').nextAll('.code').show();
  
});

$('header nav .menu').click(function () {
  
  $(this).toggleClass('on');
  $('aside').toggle();
  
});

$('.section .nav').click(function () {
  
  $(this).parent('.section').toggleClass('collapse');
  
});
            
          
!
999px
Loading ..................

Console