Create Accordion - HTML CSS Bootstrap

HTML CSS examples for Bootstrap:Accordion

Description

Create Accordion

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Example of Bootstrap 3 Accordion</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
 </head><!-- www  .ja  v a 2s.c o  m-->
 <body>
  <div>
   <div class="panel-group" id="accordion">
    <div class="panel panel-default">
     <div class="panel-heading">
      <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">1. What is HTML?</a> </h4>
     </div>
     <div id="collapseOne" class="panel-collapse collapse in">
      <div class="panel-body">
       <p>This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. <a href="http://java2s.com" target="_blank">Learn more.</a></p>
      </div>
     </div>
    </div>
    <div class="panel panel-default">
     <div class="panel-heading">
      <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">2. What is Bootstrap?</a> </h4>
     </div>
     <div id="collapseTwo" class="panel-collapse collapse">
      <div class="panel-body">
       <p>This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.</a></p>
      </div>
     </div>
    </div>
    <div class="panel panel-default">
     <div class="panel-heading">
      <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">3. What is CSS?</a> </h4>
     </div>
     <div id="collapseThree" class="panel-collapse collapse">
      <div class="panel-body">
       <p>This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test.
This is a test. This is a test. This is a test. <a href="http://java2s.com" target="_blank">Learn more.</a></p>
      </div>
     </div>
    </div>
   </div>
   <p><strong>Note:</strong> Click on the linked heading text to expand or collapse accordion panels.</p>
  </div>
 </body>
</html>

Related Tutorials