本文算是bootstrap学习使用的年底大总结,供大家参考,具体内容如下
bootstrap框架
BootStrap学习从现在开始,前端开发框架Bootstrap,可大大简化网站开发过程,从而深受广大开发者的喜欢。
<!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</title> <> <link href="css/bootstrap.min.css" rel="stylesheet"> <> <> <!--[if lt IE 9]> <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> </head> <body> <h1>你好</h1> <> <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <> <script src="js/bootstrap.min.js"></script> </body> </html>
导航
导航对于一位前端人员来说并不陌生。可以说导航是一个网站重要的元素组件之一,可以便于用户查找网站所提供的各项功能服务。
<nav role="navigation"><> <div><> <div> <> <button type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span>Toggle navigation</span> <span></span> <span></span> <span></span> </button> <> <a href="#">Brand</a> </div> <div id="bs-example-navbar-collapse-1"><> <> <ul> <li><a href="#">a</a></li> <li><a href="#">a</a></li> </ul> </div> </div> </nav> .navbar-inverse:改变导航条的背景颜色 .container:居中显示 固定导航条会遮盖页面内容,解决办法设置body的*padding-top*
下拉菜单
小伙伴们注意,在Bootstrap框架中的下拉菜单组件是一个独立的组件。
<li> <a href="#" data-toggle="dropdown">下拉菜单<span></span></a> <ul role="menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else</a></li> <li></li> <li><a href="#">linkkk/a></li> </ul> </li>
data属性API可以使用所有的Bootstrap插件
轮播广告(carousel)
<div id="carousel-example-generic" data-ride="carousel"> <> <ol> <li data-target="#carousel-example-generic" data-slide-to="0"></li> <li data-target="#carousel-example-generic" data-slide-to="1"></li> <li data-target="#carousel-example-generic" data-slide-to="2"></li> </ol> <> <div role="listbox"> <div> <img src="…"> <div>……</div> </div> <div> <img src="…"> <div>……</div> </div> </div> <> <a href="#carousel-example-generic" role="button" data-slide="prev"> <span></span> <pan>previous</span> </a> <a href="#carousel-example-generic" role="button" data-slide="next"> <span></span> <pan>Next</span> </a> </div>
.data-slide-to索引,指向轮播广告的内容,从0开始
.carousel设置广告框的样式(高度、背景色)
.carousel .item设置广告框的样式(高度、背景色)
栅格系统布局
<div> <div> <div>.col-md-4</div> <div>.col-md-4</div> <div>.col-md-4</div> </div> </div>
标签页tabs
<> <ul role="tablist"> <li><a href="#home" role="tab" data-toggle="tab">Home</a></li> <li><a href="#profile" role="tab" data-toggle="tab">Profile</a></li> <li><a href="#messages" role="tab" data-toggle="tab">Messages</a></li> <li><a href="#settings" role="tab" data-toggle="tab">Settings</a></li> </ul> <> <div> <div id="home">…</div> <div id="profile">…</div> <div id="messages">…</div> <div id="settings">…</div> </div>
标签页tabs
<div> <div> <div> <> <div> <button type="button" data-dismiss="modal"> <span aria-hidden="true">×</span> <span>Close</span> <h4>Modal title</h4> </button> </div> <> <div> … </div> <> <div> <button type="button" data-dismiss="modal">Close</button> <button type="button" data-dismiss="modal">Save</button> </div> </div> </div> </div>
【bootstrap学习使用(导航条、下拉菜单、轮播、栅格布局等)】相关文章:
★ JavaScript中用toString()方法返回时间为字符串