利用Bootstrap来仿制Bootstrap中文网,其基本结构为:导航栏、巨幕、缩略图。其实就是组件之间的组合,再配合重写的css样式来达到想要的效果。在布局中可以不用栅格系统,用.container就可以了,因为每个组件都独占一行。
最繁琐就是导航栏了,类的数量有点多,总是记不住,要借助资料才可以。
实例
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="../lib/dist/css/bootstrap.css"> <link rel="stylesheet" href="../css/font-awesome.css"> <script src="../lib/jquery.js"></script> <script src="../lib/dist/js/bootstrap.js"></script> <title>Bootstrap</title> </head> <body> <!--导航条--> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <!--导航条头部--> <div class="navbar-header " > <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="" class="navbar-brand hidden-sm">Bootstrap中文网</a> </div> <!--导航折叠区--> <div class="collapse navbar-collapse" id="navbar-collapse"> <ul class="nav navbar-nav"> <li class="hidden-sm"><a class="navbar-link" href="">Bootstrap2中文文档</a></li> <li><a class="navbar-link" href="">Bootstrap3中文文档</a></li> <li><a class="navbar-link" href="">Bootstrap4中文文档</a></li> <li><a class="navbar-link" href="">less 教程</a></li> <li><a class="navbar-link" href="">jQuery API</a></li> <li><a class="navbar-link" href="">网站实例</a></li> </ul> <ul CLASS="nav navbar-nav navbar-right"> <li><a href="" class="navbar-link">关于</a></li> </ul> </div> </div> </div> <!--巨幕--> <div class="jumbotron text-center" style="background: linear-gradient(to top right, #060232 ,#6A3152);color: white;padding: 100px 0"> <div class="container"> <h1>Bootstrap</h1> <h2>简洁、直观、强悍的前端开发框架,让web开发更迅速、简单</h2><br> <p> <a class="btn btn-primary btn-lg" href="">Bootstrap3中文文档(v3.3.7)</a> </p> <p> <a href="">Bootstrap2中文文档(v2.3.2)</a> </p> </div> </div> <!--缩略图--> <div class="container"> <div class="row"> <div class="col-lg-3"> <div class="thumbnail"> <a href=""> <img src="img/1.png" alt=""> </a> <div class="caption"> <h3> <a href="">优站精选<br><small>Bootstrap 网站实例</small></a> </h3> <P>Bootstrap 优站精选频道收集了众多基于 Bootstrap 构建、设计精美的、有创意的网站。</P> </div> </div> </div> <div class="col-lg-3"> <div class="thumbnail"> <a href=""> <img src="img/1.png" alt=""> </a> <div class="caption"> <h3> <a href="">优站精选<br><small>Bootstrap 网站实例</small></a> </h3> <P>Bootstrap 优站精选频道收集了众多基于 Bootstrap 构建、设计精美的、有创意的网站。</P> </div> </div> </div> <div class="col-lg-3"> <div class="thumbnail"> <a href=""> <img src="img/1.png" alt=""> </a> <div class="caption"> <h3> <a href="">优站精选<br><small>Bootstrap 网站实例</small></a> </h3> <P>Bootstrap 优站精选频道收集了众多基于 Bootstrap 构建、设计精美的、有创意的网站。</P> </div> </div> </div> <div class="col-lg-3"> <div class="thumbnail"> <a href=""> <img src="img/1.png" alt=""> </a> <div class="caption"> <h3> <a href="">优站精选<br><small>Bootstrap 网站实例</small></a> </h3> <P>Bootstrap 优站精选频道收集了众多基于 Bootstrap 构建、设计精美的、有创意的网站。</P> </div> </div> </div> </div> </div> <style> .thumbnail{ max-width: 310px; text-align: center; display: block; margin: 20px auto; } .jumbotron h1{ font-size: 100px; } .jumbotron p:last-child a{color: #999999;font-size: 14px} .jumbotron p:last-child a:hover{color:white} @media(max-width:600px) { .jumbotron h1{font-size: 60px} .jumbotron h2{font-size: 20px} } </style> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例