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

              
                <h3>Panels - jQuery</h3>
<div>
  <div class="Panel-TitleList">
    <button class="Panel-Title js-panel" data-targetPanel="#panel1">First Panel</button>
    <button class="Panel-Title js-panel" data-targetPanel="#panel2">Second Panel</button>
    <button class="Panel-Title js-panel" data-targetPanel="#panel3">Third Panel</button>
  </div>
  <div class="Panel-ContentList">
    <div id="panel1" class="Panel-Content js-contentPanel">Content of the first panel</div>
    <div id="panel2" class="Panel-Content js-contentPanel Panel-Content--hidden">I am the second panel's content</div>
    <div id="panel3" class="Panel-Content js-contentPanel Panel-Content--hidden">The third panel is the best</div>
  </div>
</div>

        
<h3>Panels - Vuejs</h3>
<div id="Vue">
  <div class="Panel-TitleList">
    <button class="Panel-Title" @click="activatePanel(1)">First Panel</button>
    <button class="Panel-Title" @click="activatePanel(2)">Second Panel</button>
    <button class="Panel-Title" @click="activatePanel(3)">Third Panel</button>
  </div>
  <div class="Panel-ContentList">
    <div v-if="activePanel === 1" class="Panel-Content">Content of the first panel</div>
    <div v-if="activePanel === 2" class="Panel-Content">I am the second panel's content</div>
    <div v-if="activePanel === 3" class="Panel-Content">The third panel is the best</div>
  </div>
</div>
              
            
!

CSS

              
                .Panel-Title {
  font-weight: 600;
  background-color: tomato;
  text-transform: uppercase;
  padding: 10px 20px;
  border-radius: 2px;
  text-align: center;
  cursor: pointer;
  border: 0;
  transition: all .5s;
}
.Panel-Title:hover {
  background-color: darkcyan;
}
.Panel-ContentList {
  margin-top: 5px;
}
.Panel-Content {
  padding: 15px;
  border: 1px solid darkcyan;
  width: 377px;
}
.Panel-Content--hidden {
  display: none;
}
              
            
!

JS

              
                // Panels with jquery
$('.js-panel').on('click', function(element) {
  var targetId = element.currentTarget.dataset.targetpanel
  $('.js-contentPanel').addClass('Panel-Content--hidden')
  $(targetId).removeClass('Panel-Content--hidden')
})

// Panels with vuejs
new Vue({
  el: '#Vue',
  data() {
    return {
      activePanel: 1
    }
  },
  methods: {
    activatePanel(panelIndex) {
      this.activePanel = panelIndex
    }
  }
})
              
            
!
999px

Console