Bootstrap 5 Accordion With Plus Minus
Bootstrap 5 Accordion With Plus Minus example snippet, It is a Bootstrap collapse panel with an open and close icon.
Preview
HTML
CSS
JavaScript
Resources
<section class="mt-5">
<div class="container">
<div class="row">
<div class="col-md-6 offset-md-3">
<h1>Bootstrap 5 Accordion With Plus Minus</h1>
<div class="accordion accordion-flush" id="accordion-list">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-content-1">
Accordion Heading 1
</button>
</h2>
<div id="accordion-content-1" class="accordion-collapse collapse" data-bs-parent="#accordion-list">
<div class="accordion-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-content-2">
Accordion Heading 2
</button>
</h2>
<div id="accordion-content-2" class="accordion-collapse collapse" data-bs-parent="#accordion-list">
<div class="accordion-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-content-3">
Accordion Heading 3
</button>
</h2>
<div id="accordion-content-3" class="accordion-collapse collapse" data-bs-parent="#accordion-list">
<div class="accordion-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-content-4">
Accordion Heading 4
</button>
</h2>
<div id="accordion-content-4" class="accordion-collapse collapse" data-bs-parent="#accordion-list">
<div class="accordion-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-content-5">
Accordion Heading 5
</button>
</h2>
<div id="accordion-content-5" class="accordion-collapse collapse" data-bs-parent="#accordion-list">
<div class="accordion-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@import url('https://fonts.googleapis.com/css2?family=Sen:wght@400;700;800&display=swap');
body {
font-family: 'Sen', sans-serif;
}
#accordion-list {
border: 1px solid #ddd;
}
.accordion-item {position: relative;}
.accordion-button:not(.collapsed) {
color: #333;
background-color: #b2dfdb;
box-shadow: inset 0 -1px 0 rgb(0 0 0 / 13%);
}
.accordion-button:not(.collapsed)::after,
.accordion-button::after {
width: auto;
height: auto;
background-image: none;
position: absolute;
right: 15px;
top: 13px;
font-size: 24px;
}
.accordion-button::after {
content: "+";
font-weight: 100;
color: #1b6ce5;
transform: translateY(-4px);
top: 20px;
}
.accordion-button:not(.collapsed)::after {
content: "-";
transform: translate(-5px, -4px);
transform: rotate(0deg);
}
Bootstrap = 5.1.3
Download Bootstrap 5 Accordion With Plus Minus snippet code.
This HTML, CSS, JavaScript and Bootstrap snippet is free (open-source) hence you can use it in your project. You can modify the above editor code and see the live update. You can also download the modify code. Feel free to play with Bootstrap 5 Accordion With Plus Minus snippet code. If you like it then don't forget to share this code with your friends.
Free code snippet playground
Let's share the example by using HTML, CSS, JavaScript and Bootstrap.