Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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 id="item-list">
<ul>
  <li>
    <a class="expand">
    <div class="right-arrow">+</div>
    <div class="icon london"></div>
    <h2>London</h2>
    <span>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy</span>
    </a>
    
    <div class="detail">
      <div><span>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.</span></div><br/>
      
      <span class="button">Connect</span>
    </div>
  </li>
  <li>
    <a class="expand">    
    <div class="right-arrow">+</div>    
    <div class="icon newyork"></div>
    <h2>New York</h2>
    <span>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat</span>
    </a>
    
    <div class="detail">
      <div><span>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.</span></div><br/>
            
      <span class="button">Connect</span>
    </div>    
  </li>
  <li>
    <a class="expand">
    <div class="right-arrow">+</div>    
    <div class="icon paris"></div>
    <h2>Paris</h2>
    <span>Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum</span>
    </a>
    
    <div class="detail">
      <div><span>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.</span></div><br/>
            
      <span class="button">Connect</span>
    </div>    
  </li>  
</ul>
</div>
              
            
!

CSS

              
                #item-list ul {
  padding: 0;
  margin: 20px 0;
  font-family: Arial, sans serif;
  color: #555;
}

#item-list ul > li {
  list-style: none;
  border-top: 1px solid #ddd;
  display: block;
  padding: 15px;
  overflow: hidden;
}

#item-list ul:last-child {
  border-bottom: 1px solid #ddd;
}

#item-list ul > li:hover {
  background: #efefef;
}

.button {
  padding: 8px 12px;
  font-size: 14px;
  background: #ccc;
  display: block:
  width: 200px;
  border-radius: 3px;
  cursor: pointer;
}

.expand {
  display: block;
  text-decoration: none;
  color: #555;
  cursor: pointer;
}

h2 {
  padding: 0;
  margin: 0 0 5px 0;
  font-size: 18px;
}

span {
  font-size: 14px;
}

.detail {
  margin: 20px 0 0 0;
  display: none;
  line-height: 22px;
}

.right-arrow {
  width: 10px;
  height: 10px;
  float: left;
  font-weight: bold;
  font-size: 20px;
  margin: 15px 15px 0 0;
}

.icon {
  height: 50px;
  width: 50px;
  float: left;
  margin: 0 15px 0 0;
}

.london {
  background: url("http://placehold.it/50x50") top left no-repeat;
}

.newyork {
  background: url("http://placehold.it/50x50") top left no-repeat;
}

.paris {
  background: url("http://placehold.it/50x50") top left no-repeat;
}
              
            
!

JS

              
                $(function() {
  $(".expand").on( "click", function() {
    $(this).next().slideToggle(100);
    $expand = $(this).find(">:first-child");
    
    if($expand.text() == "+") {
      $expand.text("-");
    } else {
      $expand.text("+");
    }
  });
});
              
            
!
999px

Console