@(Bootstrap) ##導言 Bootstrap 輪播(Carousel)插件是一種靈活的響應式的向站點添加滑塊的方式。除此以外,內容也是足夠靈活的,能夠是圖像、內嵌框架、視頻或者其餘您想要放置的任何類型的內容。 ##示例 下面演示圖片的輪播,使用bootstrap中的Carousel顯示循環播放元素插件。javascript
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> <li data-target="#carousel-example-generic" data-slide-to="1"></li> <li data-target="#carousel-example-generic" data-slide-to="2"></li> </ol> <!-- Wrapper for slides --> <div class="carousel-inner" role="listbox"> <div class="item active"> <img src="..." alt="..."> <div class="carousel-caption"> ... </div> </div> <div class="item"> <img src="..." alt="..."> <div class="carousel-caption"> ... </div> </div> ... </div> <!-- Controls --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div>
在src中插入圖片已爲圖片設置大小 還能夠爲其加上標題css
<div class="item"> <img src="..." alt="..."> <div class="carousel-caption"> <h3>...</h3> <p>...</p> </div> </div>
參考 1.Bootstrap官網中文文檔 2.W3CschoolBootstrap教程html