bootstrap5 手风琴的使用
时间:2023年10月23日
/来源:网络
/编辑:佚名
子:
类名:accordion
id:accordionExample
子项目的折叠盒子的 data-bs-parent 需要与父盒子id一致
子项目:
类名:accordion-item
子项目头部:
类名:accordion-header
id:headingOne
子项目内容盒子的 aria-labelledby 需要与头部id一致
按钮的类名:accordion-button
按钮的属性:
data-bs-toggle=”collapse”切换
data-bs-target=”#collapseOne”
aria-expanded=”true”默认是否展开
aria-controls=”collapseOne”
子项目body
类名:accordion-body
省略这个属性,展开后需要手动关闭data-bs-parent
<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>
类名:accordion
id:accordionExample
子项目的折叠盒子的 data-bs-parent 需要与父盒子id一致
子项目:
类名:accordion-item
子项目头部:
类名:accordion-header
id:headingOne
子项目内容盒子的 aria-labelledby 需要与头部id一致
按钮的类名:accordion-button
按钮的属性:
data-bs-toggle=”collapse”切换
data-bs-target=”#collapseOne”
aria-expanded=”true”默认是否展开
aria-controls=”collapseOne”
子项目body
类名:accordion-body
省略这个属性,展开后需要手动关闭data-bs-parent
<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>
新闻资讯 更多
- 【建站知识】查询nginx日志状态码大于400的请求并打印整行04-03
- 【建站知识】Python中的logger和handler到底是个什么?04-03
- 【建站知识】python3拉勾网爬虫之(您操作太频繁,请稍后访问)04-03
- 【建站知识】xpath 获取meta里的keywords及description的方法04-03
- 【建站知识】python向上取整以50为界04-03
- 【建站知识】scrapy xpath遇见乱码解决04-03
- 【建站知识】scrapy爬取后中文乱码,解决word转为html 时cp1252编码问题04-03
- 【建站知识】scrapy采集—爬取中文乱码,gb2312转为utf-804-03