Bootstrap Tutorial - Create accordion group








The following code shows how to create accordion group.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.9.1.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css">
<script type='text/javascript'
  src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
</head><!--from  w  w w  .  j  a va 2s  .  c o  m-->
<body style='margin:30px'>
  <div class="accordion" id="monogram-acc">
    <div class="accordion-group">
      <div class="accordion-heading">
        <div class="accordion-toggle" data-toggle="collapse"
          data-parent="monogram-acc" href="#Animals">Animals</div>
      </div>
      <div class="accordion-body collapse" id="Animals"> content</div>
    </div>
    <div class="accordion-group">
      <div class="accordion-heading">
        <div class="accordion-toggle" data-toggle="collapse"
          data-parent="monogram-acc" href="#Food">Food</div>
      </div>
      <div class="accordion-body collapse" id="Food"> content</div>
    </div>
  </div>
</body>
</html>

Click to view the demo