From the course: Bootstrap 4 Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Add collapse accordions

Add collapse accordions - Bootstrap Tutorial

From the course: Bootstrap 4 Essential Training

Start my 1-month free trial

Add collapse accordions

- [Narrator] Collapse and accordions are a set of related components that allow you to show or hide HTML content. Collapse is the simplest, and lets you show or hide content on a click. Accordions are similar but part of a bigger group. When one item shows, another hides, so accordions are essentially group of collapses. To set up a collapse, you create a link or a button that activates the collapse element. To that element, you add a data-toggle="collapse," and to target the element, you can use either an ID if it's an anchor tag or link, or you can use a data-target attribute if it's a button. The element that's going to show or hide has the collapse class. Now as I mentioned, accordions are essentially a group of collapses put together. It does require an additional container, and one of the elements should be showing so you add the show class on that element, and you'll need to add the class of dropdown-menu, an it's common to put these in a card style. Let's take a look at an…

Contents