Hello Dear Readers, Today In this Post, You will learn Bootstrap 5 Tutorial In Hindi #48 | Collapse Tutorial. Earlier I have shared the Bootstrap 5 Tutorial In Hindi #47 | Accordion Tutorial. and now it’s time to Bootstrap 5 Collapse Tutorial.
In this tutorial, You will learn full Bootstrap 5. If you want to go deep into the tutorial so you can watch the full video which is below Hope it will help you all thank you for visiting.
In this tutorial, you will learn Bootstrap Tutorial In Hindi, Bootstrap 5 Collapse Tutorial. Here You can learn what is a bootstrap framework, what are the advantages of the bootstrap tutorial in Hindi. Make sure to Subscribe, Share the video, and Like it, for more tutorials in Hindi like this one!
Collapse
Toggle the visibility of content across your project with a few classes and our JavaScript plugins.
How it works
The collapse JavaScript plugin is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the height
from its current value to 0
. Given how CSS handles animations, you cannot use padding
on a .collapse
element. Instead, use the class as an independent wrapping element.
Example
Click the buttons below to show and hide another element via class changes:
.collapse
hides content.collapsing
is applied during transitions.collapse.show
shows content
Generally, we recommend using a button with the data-bs-target
attribute. While not recommended from a semantic point of view, you can also use a link with the href
attribute (and a role="button"
). In both cases, the data-bs-toggle="collapse"
is required.
Multiple targets
A <button>
or <a>
can show and hide multiple elements by referencing them with a selector in its href
or data-bs-target
attribute. Multiple <button>
or <a>
can show and hide an element if they each reference it with their href
or data-bs-target
attribute
Accessibility
Be sure to add aria-expanded
to the control element. This attribute explicitly conveys the current state of the collapsible element tied to the control to screen readers and similar assistive technologies. If the collapsible element is closed by default, the attribute on the control element should have a value of aria-expanded="false"
. If you’ve set the collapsible element to be open by default using the show
class, set aria-expanded="true"
on the control instead.
The plugin will automatically toggle this attribute on the control based on whether or not the collapsible element has been opened or closed (via JavaScript, or because the user triggered another control element also tied to the same collapsible element). If the control element’s HTML element is not a button (e.g., an <a>
or <div>
), the attribute role="button"
should be added to the element.
If your control element is targeting a single collapsible element – i.e. the data-bs-target
attribute is pointing to an id
selector – you should add the aria-controls
attribute to the control element, containing the id
of the collapsible element. Modern screen readers and similar assistive technologies make use of this attribute to provide users with additional shortcuts to navigate directly to the collapsible element itself.