Hongmu Notes
Home Language Notes Use of bootstrap5 accordion
Language Notes Bootstrap

Use of bootstrap5 accordion

Use of bootstrap5 accordion

Parent box:

Class name: accordion
id:accordionExample
The data-bs-parent of the sub-project's folding box needs to be consistent with the parent box id.

Sub-projects:

Class name: accordion-item

Subproject header:

Class name: accordion-header
id:headingOne
The aria-labelledby of the sub-project content box needs to be consistent with the head id
Button class name: accordion-button
Button properties:
data-bs-toggle="collapse"toggle
data-bs-target="#collapseOne"
aria-expanded="true" Whether to expand by default
aria-controls="collapseOne"

Subproject body

Class name: accordion-body

Omit this attribute, you need to manually close data-bs-parent after expansion

<div class="accordion" id="accordionExample">
  <div class="accordion-item">
    <h2 class="accordion-header" id="headingOne">
      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
        标题 #1
      </button>
    </h2>
    <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
      <div class="accordion-body">
        内容
      </div>
    </div>
  </div>
  <div class="accordion-item">
    <h2 class="accordion-header" id="headingTwo">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
        标题 #2
      </button>
    </h2>
    <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
      <div class="accordion-body">
        内容
      </div>
    </div>
  </div>
</div>
微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

Bootstrap5 container document translation

Bootstrap5 container document translation Language Notes Bootstrap

Containers are the fundamental building blocks of Bootstrap; they are used to contain, fill, and align content within a specific device or viewport. Containers are the most basic layout elements in Bootstrap and are essential when using our default grid system. They are used to hold, fill, and (sometimes) center content. While containers can be nested, most layouts do not require nested containers. Bootstrap comes with three types of containers...
👁 190
Summary of commonly used Bootstrap 5 form `pattern` attribute

Summary of commonly used Bootstrap 5 form `pattern` attribute Language Notes Bootstrap

Summary of commonly used Bootstrap 5 form `pattern` attribute: **Text input field validation**: Validates whether the value entered into a text input field matches a specified regular expression. For example, `pattern= "[a-zA-Z]{3,}$" ` ensures that the string contains at least 3 letters, and the last character cannot be a digit or a space. **Password input field validation**: Validates whether the value entered into a password input field matches a specified regular expression. For example,...
👁 339

Recommended reading

Fruit and Vegetable Farm Website Template 1210

Fruit and Vegetable Farm Website Template 1210 Practical Collection Yiyou template

An EyouCMS website template designed specifically for fruit and vegetable farms. Its fresh and natural design effectively showcases the farming environment, produce offerings, harvesting experiences, and brand stories. This template helps agricultural businesses showcase their products online and expand their sales channels. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (Eyou...
👁 67
Responsive Pu-erh Tea Product Display Template 1211

Responsive Pu-erh Tea Product Display Template 1211 Practical Collection Yiyou template

This EyouCMS responsive template is ideal for showcasing tea and Pu-erh tea products. Its classical and elegant design allows you to effectively present Pu-erh tea products, brand stories, tea ceremony culture, and sales information. It helps Pu-erh tea brands showcase their products online and attract tea enthusiasts. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 30
Nongjiale (Rural Tourism) Culinary & Hotel Website Template – 1212

Nongjiale (Rural Tourism) Culinary & Hotel Website Template – 1212 Practical Collection Yiyou template

An eYouCMS website template designed for agritourism businesses, gourmet food establishments, guesthouse operators, and hotel managers. Its warm and natural design effectively showcases rural landscapes, signature local cuisine, guestroom facilities, and tourism services. This template helps agritourism businesses attract online visitors and enhance their brand awareness. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for eYouCMS | eYou...
👁 35
Resource website typecho001 template

Resource website typecho001 template Program Notes Typecho

typecho001 template template please do not modify the folder name of this template. The folder name is: typecho001 1.4 Fix the js output problem on the article page 1.3 Fix the error prompt when the plug-in is not installed Optimize the list page code output 1.2 Fix the comment function and add a custom homepage title 1.1 Fix the comment reply asymmetry function Add a separate title setting function on the homepage Add the website favicon.ico icon Add one...
👁 198
Culinary and Food Service Training School Website Template 1213

Culinary and Food Service Training School Website Template 1213 Practical Collection Yiyou template

This EyouCMS template is ideal for culinary, food service, snack preparation, and training institutions. Its food-themed design is perfect for showcasing cooking courses, snack preparation training programs, faculty expertise, and student projects. It helps food service training organizations attract learners online and enhance their brand awareness. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 33
Modification of typecho paging style

Modification of typecho paging style Program Notes Typecho

Sir, times have changed! Typecho is currently the most perfect solution, because Baidu can only see the code of fixed thinking. The actual generated HTML code is breathtakingly clean and fully customized, including adding classes to the li element, adding classes to the a element, adding classes to the previous page and next page, and removing the li tags that come with typecho to express more. I can even add some text to the content inside...
👁 516