Bootstrap is an open source toolkit for front-end development exited by Twitter. It was developed by Twitter designers Mark Otto and Jacob Thornton and is a CSS/HTML framework. Bootstrap provides elegant HTML and CSS specifications, which are written in dynamic CSS language and Less. Bootstrap has been very popular since its launch and has been a popular open source project on GitHub, including NASA's MSNBC (Microsoft National Broadcasting Company) Breaking News.
since 🎜>
Preparation:1. Download the bootstrap file from the official website http://v3.bootcss.com/getting-started/
2. The website references the bootstrap file
Note: The bootstrap script is based on jquery. You need to quote jquery before referencing bootstrap.min.js. The jquery version supports Version 1.9.1 or above.
1: Navigation bar
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <ul class="nav nav-pills" > <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">首页 <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="#">Home</a></li> <li><a href="#">Profile</a></li> <li><a href="#">Messages</a></li> </ul> </li> <li><a href="#">Home</a></li> <li><a href="#">Home</a></li> <li><a href="#">Home</a></li> </ul> </div> </nav>
Two: Carousel carousel
<div id="myCarousel" class="carousel slide" data-ride="carousel"> <!--轮播指标--> <ol class="carousel-indicators"> <li data-target="#myCarousel" data-slide-to="0" class="active"></li> <li data-target="#myCarousel" data-slide-to="1"></li> <li data-target="#myCarousel" data-slide-to="2"></li> </ol> <!--轮播项目--> <div class="carousel-inner" role="listbox"> <div class="item active"> <img src="../Img/xx.png" /> <div class="container"> <div class="carousel-caption">标题1</div> </div> </div> <div class="item"> <img src="../Img/xx.png" /> <div class="container"> <div class="carousel-caption">标题2</div> </div> </div> <div class="item"> <img src="../Img/xx.png" /> <div class="container"> <div class="carousel-caption">标题3</div> </div> </div> </div> <!--轮播导航--> <a class="carousel-control left" href="#myCarousel" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control right" href="#myCarousel" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">Next</span> </a> </div>
Usage:
Through the data attribute: Use the data attribute to control the position of the carousel.
The attribute data-slide accepts the keyword prev or next, which is used to change the position of the slide relative to the current position.
Use the data-ride="carousel" attribute to mark the carousel to start playing animation when the page loads.
Via javascript: Can be called manually via $('.carousel').carousel().
For specific usage methods, you can go to bootstrap official website http://www.bootcss.com/