Bootstrap轮播效果详解

Bootstrap轮播效果详解

导言

Bootstrap 轮播(Carousel)插件是一种灵活的响应式的向站点添加滑块的方式。除此之外,内容也是足够灵活的,可以是图像、内嵌框架、视频或者其他您想要放置的任何类型的内容。

示例

下面演示图片的轮播,使用bootstrap中的Carousel显示循环播放元素插件。

<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中插入图片已为图片设置大小

还可以为其加上标题

<div class="item"> <img src="..." alt="..."> <div class="carousel-caption"> <h3>...</h3> <p>...</p> </div></div>

参考

1.Bootstrap官网中文文档

2.菜鸟学堂Bootstrap教程

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

tag:详解效果电脑软件Bootstrap

相关内容