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.

              <ul class="foo">

<div class="btn-set">
  <button id="toggle">Collaspe</button>
  <button id="reset">Reset</button>
              .foo {
  margin: 10px auto;
  padding: 4px;
  border: 4px solid green;

.foo:after {
    content: "";
    display: table;
    clear: both;

.foo li {
  padding: 2px;
  border: 1px solid #555;
  border-right: 0;
  width: 50px;
  line-height: 50px;
  list-style-type: none;
  float: left;
  text-align: center;

.foo li:last-child {border-right: 1px solid;}

.btn-set {text-align: center;}
   * Click and dirty container element collaspe without using
   * inline-block so margin auto can be used to center the parent.
   * @param string A css selector containing one or more child elements.

  function collaspe(elem){
    var last_item = $(elem).find('li:last-child');
    var bar = parseFloat( $(elem).css('borderLeftWidth')) + parseFloat( $(elem).css('paddingRight'));
    var left_edge = ((last_item).offset().left + $(last_item).outerWidth()) - $(elem).offset().left - bar;


  // Setup interactive events.
  $('#toggle').on( 'click', function(){
  $('#reset').on( 'click', function(){
Loading ..................