Bootstrap 4 Accordion

Below codes are used to implementing Accordion tab using Bootstrap 4.1 version.


<html>
<head>
	<!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<!-- Bootstrap CSS -->
	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="accordion" id="accordion">
  <div class="card">
    <div class="card-header" id="headingOne">
	<a class="collapsed card-link" data-toggle="collapse" href="#collapseOne">
		Tab #1
	</a>
    </div>

    <div id="collapseOne" class="collapse show" data-parent="#accordion">
      <div class="card-body">
		Tab 1 Content
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingTwo">
	<a class="collapsed card-link" data-toggle="collapse" href="#collapseTwo">
		Tab #2 
	</a>
    </div>
    <div id="collapseTwo" class="collapse" data-parent="#accordion">
      <div class="card-body">
		Tab 2 Content
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-header" id="headingThree">
	<a class="collapsed card-link" data-toggle="collapse" href="#collapseThree">
		Tab #3
	</a>
    </div>
    <div id="collapseThree" class="collapse" data-parent="#accordion">
      <div class="card-body">
			Tab 3 Content
      </div>
    </div>
  </div>
</div>
</div>
	<!-- Script section -->
	<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
	<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>

You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *