Bootstrap 折叠(collapse) 初见
以下代码来自bootstrap中文网
1 <!DOCTYPE html> 2 <html lang="zh-CN"> 3 <head> 4 <meta charset="utf-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 6 <meta name="viewport" content="width=device-width, initial-scale=1"> 7 <title>Bootstrap 模板</title> 8 <link href="lib/bootstrap/css/bootstrap.css" rel="stylesheet"> 9 <!--[if lt IE 9]> 10 <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script> 11 <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> 12 <![endif]--> 13 <style> 14 15 </style> 16 </head> 17 <body> 18 19 <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> 20 21 22 <div class="panel panel-default"> 23 <!-- 折叠分组1的头 --> 24 <div class="panel-heading" role="tab" id="headingOne"> 25 <!-- 整个h4里面是标题栏 --> 26 <h4 class="panel-title"> 27 <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> 28 折叠分组1的标题 29 </a> 30 </h4> 31 32 </div> 33 34 <!-- 折叠分组的内容 in 决定是否展开 下面的内容 --> 35 <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne"> 36 37 <div class="panel-body"> 38 内容(Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.) 39 </div> 40 </div> 41 </div> 42 43 44 45 <div class="panel panel-default"> 46 <div class="panel-heading" role="tab" id="headingTwo"> 47 <h4 class="panel-title"> 48 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> 49 折叠分组2的标题 50 </a> 51 </h4> 52 </div> 53 <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo"> 54 <div class="panel-body"> 55 内容(Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.) 56 </div> 57 </div> 58 </div> 59 60 61 62 <div class="panel panel-default"> 63 <div class="panel-heading" role="tab" id="headingThree"> 64 <h4 class="panel-title"> 65 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> 66 折叠分组3的标题 67 </a> 68 </h4> 69 </div> 70 <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree"> 71 <div class="panel-body"> 72 内容(Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.) 73 </div> 74 </div> 75 </div> 76 77 78 79 80 </div> 81 82 83 <script src="lib/jquery/jquery.js"></script> 84 <script src="lib/bootstrap/js/bootstrap.js"></script> 85 </body> 86 </html>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步