ShapeYourPath
(current)
Run Code
Live Code Editor- Bootstrap 5 Collapse Example
Source Code
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"> <title>Bootstrap 5 Collapse Example</title> <style type="text/css"> h4{color:red;font-size: 32px;} </style> </head> <body> <div class="container mt-4"> <h1>Bootstrap 5 Collapse Example</h1> <a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample"> Link with href </a> <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> Button with data-bs-target </button> </p> <div class="collapse" id="collapseExample"> <div class="card card-body"> This panel is hidden by default but revealed when the user clicks the button. Let us see it with an example. </div> </div> </div><!--/container--> <!-- Option 1: Bootstrap Bundle with Popper --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"></script> </body> </html>
Output :
Running