Pen Settings



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


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


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.


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.


  <li><a href="#">
    <img src="" width="20" height="20" alt=""><span>Home</span></a></li>
  <li class="selected"><a class="toggle" href="#example"><img src="" width="20" height="20" alt=""><span>Billing</span><img src="" width="12" height="12" alt="" class="chevron">
    <div class="toggle-content" id="example">
        <li><a href="#">My Bill</a></li>
        <li><a href="#">Pay History</a></li>
  <li><a href="#">
    <img src="" width="20" height="20" alt=""><span>Employees</span></a></li>
  <li><a href="#"><img src="" width="20" height="20" alt=""><span>Claims</span></a></li>
  <li><a href="#"><img src="" width="20" height="20" alt=""><span>Docs</span></a></li>


                .toggle {
  border-left: 5px solid #015295;
  padding-left: calc(1.5rem - 5px);

.toggle-content {
  display: none;
  height: 0;
  overflow: hidden;
  transition: height .3s ease-in-out;
} {
  display: block;
  height: auto;

/* general styling */
body {
  margin: 0;

ul {
  font-family: sans-serif;
  list-style-type: none;
  margin: 0;
  padding: 0;
  width: 100%;

li {
  color: #404040;
  font-size: .875rem;
  letter-spacing: .5px;
  text-transform: uppercase;

.selected {
  background-color: #f2f6f9;

li ul {
  margin-left: calc(1.5rem + .75rem);
  padding: 0;  

li img {
  margin-right: 1rem;

li a {
  color: inherit;
  display: block;
  padding: 1.15rem 1.5rem 1.15rem;
  text-decoration: none;

li a:hover {
  background-color: #f2f6f9;

li img,
li span {
    vertical-align: middle;

li li {
  background-color: transparent;
  text-transform: initial;

.chevron {
  float: right;
  margin: .35rem 0 0 0;

@media only screen and (max-width: 800px) {
  li {
    font-size: 1rem;


                // Show an element
var show = function (elem) {

  // Get the natural height of the element
  var getHeight = function () { = 'block'; // Make it visible
    var height = elem.scrollHeight + 'px'; // Get it's height = ''; //  Hide it again
    return height;

  var height = getHeight(); // Get the natural height
  elem.classList.add('is-visible'); // Make the element visible = height; // Update the max-height

  // Once the transition is complete, remove the inline max-height so the content can scale responsively
  window.setTimeout(function () { = '';
  }, 350);


// Hide an element
var hide = function (elem) {

  // Give the element a height to change from = elem.scrollHeight + 'px';

  // Set the height back to 0
  window.setTimeout(function () { = '0';
  }, 1);

  // When the transition is complete, hide it
  window.setTimeout(function () {
    console.log('window.setTimeout:remove is-visible');
  }, 300);


// Toggle element visibility
var toggle = function (elem, timing) {

  // If the element is visible, hide it
  if (elem.classList.contains('is-visible')) {
    console.log('hide element');

  // Otherwise, show it
  console.log('show element');


// Listen for click events
document.addEventListener('click', function (event) {

  // Make sure clicked element is our toggle
  if (!'a').classList.contains('toggle')) {

  // Prevent default link behavior

  // Get the content
  var content = document.querySelector('a').hash);
  if (!content) return;

  // Toggle the content

}, false);