Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Auto Save

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

              
                <header>
  <div class="container">
    <h1>Bootstrap</h1>
    <h3>Accordion</h3>
  </div>
</header>

<nav class="navbar navbar-default no-margin no-border no-radius">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-i">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#home">Home</a>
    </div>
    <div class="collapse navbar-collapse" id="navbar-i">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#one">One</a></li>
        <li><a href="#two">Two</a></li>
        <li><a href="#three">Three</a></li>
      </ul>
    </div>
  </div>
</nav>

<main id="home" class="contents">
  <section id="one" class="i-row i-row-odd ir-white">
    <div class="container">
      <h2 class="section-title">Accordion One</h2>
      <div class="row">
        <div class="col-md-6">
          <!-- Defaults -->
          <h3>Default <i class="fa fa-thumbs-o-down"></i> <small>CSS</small></h3>
          <div class="panel-group d-accordion">
            <div class="panel panel-default">
              <div class="panel-heading" data-toggle="collapse" data-parent=".d-accordion" href="#aboutus">
                <h4 class="panel-title">About Us <i class="fa fa-chevron-up pull-right"></i></h4>
              </div>
              <div id="aboutus" class="panel-collapse collapse in">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dsignissim. Egestas</p>
                </div>
              </div>
            </div>
            <div class="panel panel-default">
              <div class="panel-heading" data-toggle="collapse" data-parent=".d-accordion" href="#whoweare">
                <h4 class="panel-title">Who We Are <i class="fa fa-chevron-up pull-right"></i></h4>
              </div>
              <div id="whoweare" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                </div>
              </div>
            </div>
            <div class="panel panel-default">
              <div class="panel-heading" data-toggle="collapse" data-parent=".d-accordion" href="#contactus">
                <h4 class="panel-title">Contact Us <i class="fa fa-chevron-up pull-right"></i></h4>
              </div>
              <div id="contactus" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="col-md-6">
          <!-- Fixed -->
          <h3>Fixed <i class="fa fa-thumbs-o-up"></i> <small>jQuery</small></h3>
          <div class="panel-group i-accordion">
            <div class="panel panel-success">
              <div class="panel-heading" data-toggle="collapse" data-parent=".i-accordion" href="#aboutus2">
                <h4 class="panel-title">About Us <i class="fa fa-chevron-up pull-right"></i></h4>
              </div>
              <div id="aboutus2" class="panel-collapse collapse in">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                </div>
              </div>
            </div>
            <div class="panel panel-success">
              <div class="panel-heading" data-toggle="collapse" data-parent=".i-accordion" href="#whoweare2">
                <h4 class="panel-title">Who We Are <i class="fa fa-chevron-down pull-right"></i></h4>
              </div>
              <div id="whoweare2" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                </div>
              </div>
            </div>
            <div class="panel panel-success">
              <div class="panel-heading" data-toggle="collapse" data-parent=".i-accordion" href="#contactus2">
                <h4 class="panel-title">Contact Us <i class="fa fa-chevron-down pull-right"></i></h4>
              </div>
              <div id="contactus2" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
  <section id="two" class="i-row i-row-even">
    <div class="container">
      <h2 class="section-title">Accordion Two</h2>
      <div class="row">
        <div class="col-md-6">
          <!-- Fixed -->
          <h3>Fixed <i class="fa fa-thumbs-o-up"></i> <small>jQuery</small></h3>
          <div class="panel-group accordion-2a">
            <div class="panel panel-info">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-2a" href="#a2-a01">
                <h4 class="panel-title">About Us <i class="fa fa-minus pull-right"></i></h4>
              </div>
              <div id="a2-a01" class="panel-collapse collapse in">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                  <p>Ricotta danish fontina mozzarella. Boursin stinking bishop roquefort rubber cheese cheese and wine cheese on toast parmesan croque monsieur. Cut the cheese swiss babybel danish fontina stilton halloumi edam queso. Fromage frais squirty cheese cheese slices dolcelatte fromage when the cheese comes out everybody's happy airedale boursin. Cheese and wine when the cheese comes out everybody's happy halloumi.</p>
                  <p>Boursin who moved my cheese emmental. Swiss bavarian bergkase cheesy feet roquefort stilton jarlsberg cheesy feet cottage cheese. Mascarpone cauliflower cheese feta hard cheese smelly cheese ricotta taleggio boursin. Jarlsberg cut the cheese.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-info">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-2a" href="#a2-a02">
                <h4 class="panel-title">Who We Are <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a2-a02" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Jarlsberg croque monsieur say cheese. Stilton cheddar cheese and biscuits pecorino cream cheese cheese triangles rubber cheese jarlsberg. Macaroni cheese cheese strings cheese slices parmesan bavarian bergkase chalk and cheese fondue parmesan. Parmesan macaroni cheese rubber cheese who moved my cheese hard cheese who moved my cheese the big cheese.</p>
                  <p>Cheeseburger rubber cheese macaroni cheese. Stinking bishop say cheese stilton melted cheese cheeseburger cheeseburger blue castello caerphilly. Roquefort cheese strings ricotta cheese strings when the cheese comes out everybody's happy mascarpone queso cheese triangles. Say cheese dolcelatte stinking bishop bocconcini st. agur blue cheese pepper jack.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-info">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-2a" href="#a2-a03">
                <h4 class="panel-title">Contact Us <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a2-a03" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Roquefort fondue queso. Cheeseburger cheese and biscuits cheesecake cheese strings cheddar say cheese mascarpone halloumi. Macaroni cheese feta fromage frais cheese and biscuits cheesecake cauliflower cheese emmental pecorino. Jarlsberg cut the cheese brie who moved my cheese when the cheese comes out everybody's happy monterey jack squirty cheese.</p>
                  <p>The big cheese danish fontina edam. Rubber cheese cauliflower cheese halloumi everyone loves mozzarella cheese slices macaroni cheese cheesecake. Bavarian bergkase squirty cheese cream cheese cow fondue boursin boursin cut the cheese. Cow.</p>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="col-md-6">
          <!-- Fixed -->
          <h3>Fixed <i class="fa fa-thumbs-o-up"></i> <small>jQuery</small></h3>
          <div class="panel-group accordion-2b">
            <div class="panel panel-danger">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-2b" href="#a2-b01">
                <h4 class="panel-title">About Us <i class="fa fa-minus pull-right"></i></h4>
              </div>
              <div id="a2-b01" class="panel-collapse collapse in">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                  <p>Ricotta danish fontina mozzarella. Boursin stinking bishop roquefort rubber cheese cheese and wine cheese on toast parmesan croque monsieur. Cut the cheese swiss babybel danish fontina stilton halloumi edam queso. Fromage frais squirty cheese cheese slices dolcelatte fromage when the cheese comes out everybody's happy airedale boursin. Cheese and wine when the cheese comes out everybody's happy halloumi.</p>
                  <p>Boursin who moved my cheese emmental. Swiss bavarian bergkase cheesy feet roquefort stilton jarlsberg cheesy feet cottage cheese. Mascarpone cauliflower cheese feta hard cheese smelly cheese ricotta taleggio boursin. Jarlsberg cut the cheese.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-danger">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-2b" href="#a2-b02">
                <h4 class="panel-title">Who We Are <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a2-b02" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Jarlsberg croque monsieur say cheese. Stilton cheddar cheese and biscuits pecorino cream cheese cheese triangles rubber cheese jarlsberg. Macaroni cheese cheese strings cheese slices parmesan bavarian bergkase chalk and cheese fondue parmesan. Parmesan macaroni cheese rubber cheese who moved my cheese hard cheese who moved my cheese the big cheese.</p>
                  <p>Cheeseburger rubber cheese macaroni cheese. Stinking bishop say cheese stilton melted cheese cheeseburger cheeseburger blue castello caerphilly. Roquefort cheese strings ricotta cheese strings when the cheese comes out everybody's happy mascarpone queso cheese triangles. Say cheese dolcelatte stinking bishop bocconcini st. agur blue cheese pepper jack.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-danger">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-2b" href="#a2-b03">
                <h4 class="panel-title">Contact Us <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a2-b03" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Roquefort fondue queso. Cheeseburger cheese and biscuits cheesecake cheese strings cheddar say cheese mascarpone halloumi. Macaroni cheese feta fromage frais cheese and biscuits cheesecake cauliflower cheese emmental pecorino. Jarlsberg cut the cheese brie who moved my cheese when the cheese comes out everybody's happy monterey jack squirty cheese.</p>
                  <p>The big cheese danish fontina edam. Rubber cheese cauliflower cheese halloumi everyone loves mozzarella cheese slices macaroni cheese cheesecake. Bavarian bergkase squirty cheese cream cheese cow fondue boursin boursin cut the cheese. Cow.</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
  <section id="three" class="i-row i-row-odd">
    <div class="container">
      <h2 class="section-title">Accordion Three</h2>
      <div class="row">
        <div class="col-md-12">
          <!-- Fixed -->
          <h3>Fixed <i class="fa fa-thumbs-o-up"></i> <small>jQuery</small></h3>
          <div class="panel-group accordion-3">
            <div class="panel panel-info">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-3" href="#a3-a01">
                <h4 class="panel-title">About Us <i class="fa fa-minus pull-right"></i></h4>
              </div>
              <div id="a3-a01" class="panel-collapse collapse in">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                  <p>Ricotta danish fontina mozzarella. Boursin stinking bishop roquefort rubber cheese cheese and wine cheese on toast parmesan croque monsieur. Cut the cheese swiss babybel danish fontina stilton halloumi edam queso. Fromage frais squirty cheese cheese slices dolcelatte fromage when the cheese comes out everybody's happy airedale boursin. Cheese and wine when the cheese comes out everybody's happy halloumi.</p>
                  <p>Boursin who moved my cheese emmental. Swiss bavarian bergkase cheesy feet roquefort stilton jarlsberg cheesy feet cottage cheese. Mascarpone cauliflower cheese feta hard cheese smelly cheese ricotta taleggio boursin. Jarlsberg cut the cheese.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-info">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-3" href="#a3-a02">
                <h4 class="panel-title">Who We Are <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a3-a02" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Jarlsberg croque monsieur say cheese. Stilton cheddar cheese and biscuits pecorino cream cheese cheese triangles rubber cheese jarlsberg. Macaroni cheese cheese strings cheese slices parmesan bavarian bergkase chalk and cheese fondue parmesan. Parmesan macaroni cheese rubber cheese who moved my cheese hard cheese who moved my cheese the big cheese.</p>
                  <p>Cheeseburger rubber cheese macaroni cheese. Stinking bishop say cheese stilton melted cheese cheeseburger cheeseburger blue castello caerphilly. Roquefort cheese strings ricotta cheese strings when the cheese comes out everybody's happy mascarpone queso cheese triangles. Say cheese dolcelatte stinking bishop bocconcini st. agur blue cheese pepper jack.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-info">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-3" href="#a3-a03">
                <h4 class="panel-title">Contact Us <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a3-a03" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Roquefort fondue queso. Cheeseburger cheese and biscuits cheesecake cheese strings cheddar say cheese mascarpone halloumi. Macaroni cheese feta fromage frais cheese and biscuits cheesecake cauliflower cheese emmental pecorino. Jarlsberg cut the cheese brie who moved my cheese when the cheese comes out everybody's happy monterey jack squirty cheese.</p>
                  <p>The big cheese danish fontina edam. Rubber cheese cauliflower cheese halloumi everyone loves mozzarella cheese slices macaroni cheese cheesecake. Bavarian bergkase squirty cheese cream cheese cow fondue boursin boursin cut the cheese. Cow.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-danger">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-3" href="#a3-a04">
                <h4 class="panel-title">About Us <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a3-a04" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Nec tristique! Odio sit turpis ac sit magna, non. Elementum ultrices tristique, rhoncus lectus, turpis ac, purus magna! Et massa pulvinar ridiculus dignissim. Egestas</p>
                  <p>Ricotta danish fontina mozzarella. Boursin stinking bishop roquefort rubber cheese cheese and wine cheese on toast parmesan croque monsieur. Cut the cheese swiss babybel danish fontina stilton halloumi edam queso. Fromage frais squirty cheese cheese slices dolcelatte fromage when the cheese comes out everybody's happy airedale boursin. Cheese and wine when the cheese comes out everybody's happy halloumi.</p>
                  <p>Boursin who moved my cheese emmental. Swiss bavarian bergkase cheesy feet roquefort stilton jarlsberg cheesy feet cottage cheese. Mascarpone cauliflower cheese feta hard cheese smelly cheese ricotta taleggio boursin. Jarlsberg cut the cheese.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-danger">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-3" href="#a3-a05">
                <h4 class="panel-title">Who We Are <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a3-a05" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Jarlsberg croque monsieur say cheese. Stilton cheddar cheese and biscuits pecorino cream cheese cheese triangles rubber cheese jarlsberg. Macaroni cheese cheese strings cheese slices parmesan bavarian bergkase chalk and cheese fondue parmesan. Parmesan macaroni cheese rubber cheese who moved my cheese hard cheese who moved my cheese the big cheese.</p>
                  <p>Cheeseburger rubber cheese macaroni cheese. Stinking bishop say cheese stilton melted cheese cheeseburger cheeseburger blue castello caerphilly. Roquefort cheese strings ricotta cheese strings when the cheese comes out everybody's happy mascarpone queso cheese triangles. Say cheese dolcelatte stinking bishop bocconcini st. agur blue cheese pepper jack.</p>
                </div>
              </div>
            </div>
            <div class="panel panel-danger">
              <div class="panel-heading" data-toggle="collapse" data-parent=".accordion-3" href="#a3-a06">
                <h4 class="panel-title">Contact Us <i class="fa fa-plus pull-right"></i></h4>
              </div>
              <div id="a3-a06" class="panel-collapse collapse">
                <div class="panel-body">
                  <p>Roquefort fondue queso. Cheeseburger cheese and biscuits cheesecake cheese strings cheddar say cheese mascarpone halloumi. Macaroni cheese feta fromage frais cheese and biscuits cheesecake cauliflower cheese emmental pecorino. Jarlsberg cut the cheese brie who moved my cheese when the cheese comes out everybody's happy monterey jack squirty cheese.</p>
                  <p>The big cheese danish fontina edam. Rubber cheese cauliflower cheese halloumi everyone loves mozzarella cheese slices macaroni cheese cheesecake. Bavarian bergkase squirty cheese cream cheese cow fondue boursin boursin cut the cheese. Cow.</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
</main>

<footer>
  <div class="container">
    <p class="text-muted no-margin">Powered by Ivan 2015</p>
  </div>
</footer>
              
            
!

CSS

              
                html { min-height: 100%; position: relative; }
body { margin-bottom: 60px; }
.btn, .btn:hover, .btn:focus, .btn:active, .btn:active:focus { outline: 0; }
.btn-custom { margin-bottom: 1em; }
.no-margin { margin: 0; }
.no-padding { padding: 0; }
.no-border { border: 0; }
.no-radius { border-radius: 0; }

/*** Header ***/
header { padding: 30px 0; background-color: #6f5499; color: #fff; }
  header h1 { margin: 0; }
  header h3 { margin: 0; color: rgba(255,255,255,.4); }

/*** Nav ***/
.navbar-default { background-color: #f5f5f5; box-shadow: 0 1px 0 0 rgba(0,0,0,0.1); }
  .navbar-default .nav>li>a:focus, 
  .navbar-default .nav>li>a:hover { background-color: #e5e5e5; }

/*** Content ***/
main {}
  .i-row { padding-top: 40px; padding-bottom: 40px; }
  .i-row-odd { background-color: #ffffff; }
  .i-row-even { background-color: #f7f7f7; }

.section-title { margin-top: 0; margin-bottom: 0.6em; font-weight: 500; }
.section-title .fa { margin-right: 5px; color: #6f5499; }

/*** Footer ***/
footer { padding: 20px 0; background-color: #333; position: absolute; bottom: 0; width: 100%; height: 60px; }

/******************************************/

.i-accordion .panel-heading,
.d-accordion .panel-heading,
.accordion-2a .panel-heading,
.accordion-2b .panel-heading,
.accordion-3 .panel-heading { cursor: pointer; }
.d-accordion .panel-heading.collapsed .fa-chevron-up:before { content: '\f078'; }

              
            
!

JS

              
                $(function () {
  // Smooth Scroll
  $('a[href*=#]').bind('click', function(e){
    var anchor = $(this);
    $('html, body').stop().animate({
      scrollTop: $(anchor.attr('href')).offset().top
    }, 1000);
    e.preventDefault();
  });
});

$('.i-accordion').on('show.bs.collapse', function(n){
  $(n.target).siblings('.panel-heading').find('.panel-title i').toggleClass('fa-chevron-down fa-chevron-up');
});
$('.i-accordion').on('hide.bs.collapse', function(n){
  $(n.target).siblings('.panel-heading').find('.panel-title i').toggleClass('fa-chevron-up fa-chevron-down');
});

/* P */
$('.accordion-2a, .accordion-2b, .accordion-3').on('show.bs.collapse', function(n){
  $(n.target).siblings('.panel-heading').find('.panel-title i').toggleClass('fa-minus fa-plus');
});
$('.accordion-2a, .accordion-2b, .accordion-3').on('hide.bs.collapse', function(n){
  $(n.target).siblings('.panel-heading').find('.panel-title i').toggleClass('fa-plus fa-minus');
});
              
            
!
999px

Console