<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <!--bootstrap要引入的文件:bootstrap.min.css,jquery.min.js,bootrap.min.js--> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/> <script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script> <!--要在bootstrap之前引入jquery,bootstrap依赖JQUERY,因为bootstrapJS里要使用$这个jquery变量--> <!--<script src="js/popper.js" type="text/javascript" charset="utf-8"></script>--> <!--如果你要用bootstrap使用一些提示性的交互,那么就需要引入提示性的框架popper.js,因为bootstrap的提示就是依赖popper--> <script src="js/bootstrap.js" type="text/javascript" charset="utf-8"></script> </head> <body> <p> <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button"> Link with href </a> <!-- data-toggle:定义JS的切换功能的组件,collapse data-target:定义要切换折叠的对象,属性值是相对应的ID,在A标签里面可以使用href属性代替 --> <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" > Button with data-target </button> </p> <div class="collapse" id="collapseExample"> <div class="card card-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. </div> </div> </body> </html>