Bootstrap uses carousel to create sliding of the image
<style> .carousel-inner > .item > img, .carousel-inner > .item > a > img { width: 70%; margin: auto; } </style> </head> <body> <h2>Image sliding</h2> <div class="container"> <br> <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> <li data-target="#myCarousel" data-slide-to="3"></li> </ol> <div class="carousel-inner"> <div class="item active"> <img src="download.png" /> </div> <div class="item"> <img src="download (1).png" /> </div> <div class="item"> <img src="download2.jpg" /> </div> <div class="item"> <img src="download 3.jpg" /> </div> </div> <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" ></span> <span class="sr-only">Next</span> </a> </div> </div>
container
, we have taken another div with id as mycarousel
with class attribute value carousel slide
and data-ride
as carousel, we have used style sheet to define the carousel-inner
values to set margin and width carousel-indicators
with ol elements as data-target
as mycarousel
with data-slide
as 0 to 3 and data-slide ="0" is in active statecarousel-inner
to define the images to slideleft
carousel-control
and right carousel-control
with href as #mycarousel
, role as button and data-slide
=previous and next, the span with class attribute glyphicon icons
as chevron left and right output
Views: 7182 | Post Order: 44