案例1:首页顶部
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap 101 Template</title> <link href="../css/bootstrap.min.css" rel="stylesheet"> <script src="../js/jquery-3.3.1.min.js"></script> <script src="../js/bootstrap.min.js"></script> </head> <body> <div class="container"> <div class="row"> <div class="col-lg-4"> <img src="../img/logo2.png"/> </div> <div class="col-lg-4 visible-lg"> <img src="../img/header.png"/> </div> <div class="col-lg-4"> <ul class="list-inline" style="padding-top: 25px;"> <li><a href="#">登录</a></li> <li><a href="#">注册</a></li> <li><a href="#">购物车</a></li> </ul> </div> </div> </div> </body> </html>
案例2:首页导航条组件
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap 101 Template</title> <link href="../css/bootstrap.min.css" rel="stylesheet"> <script src="../js/jquery-3.3.1.min.js"></script> <script src="../js/bootstrap.min.js"></script> </head> <body> <div class="container"> <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <!-- 汉堡按钮 --> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">首页</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <!--谁被选中,谁家active --> <li class="active"><a href="#">手机数码<span class="sr-only">(current)</span></a></li> <li><a href="#">电脑办公</a></li> <li><a href="#">电脑办公</a></li> <li><a href="#">电脑办公</a></li> </ul> <form class="navbar-form navbar-right" role="search"> <div class="form-group"> <input type="text" class="form-control" placeholder="Search"> </div> <button type="submit" class="btn btn-default">Submit</button> </form> </div> </div> </nav> </div> </body> </html>