创新互联Bootstrap4教程:Bootstrap4 轮播

Bootstrap4 轮播

轮播是一个循环的幻灯片:

如何创建轮播

以下实例创建了一个简单的图片轮播效果 :

实例

<
div

id
=
"
demo
"

class
=
"
carousel slide
"

data-ride
=
"
carousel
"
>



<
ul

class
=
"
carousel-indicators
"
>

<
li

data-target
=
"
#demo
"

data-slide-to
=
"
0
"

class
=
"
active
"
>
li
>

<
li

data-target
=
"
#demo
"

data-slide-to
=
"
1
"
>
li
>

<
li

data-target
=
"
#demo
"

data-slide-to
=
"
2
"
>
li
>

ul
>



<
div

class
=
"
carousel-inner
"
>

<
div

class
=
"
carousel-item active
"
>

<
img

decoding
=
"
async
"

src
=
"
https://static.cdccxhl.com/images/mix/img_fjords_wide.jpg
"
>

div
>

<
div

class
=
"
carousel-item
"
>

<
img

decoding
=
"
async
"

src
=
"
https://static.cdcxhl.com/images/mix/img_nature_wide.jpg
"
>

div
>

<
div

class
=
"
carousel-item
"
>

<
img

decoding
=
"
async
"

src
=
"
https://static.cdcxhl.com/images/mix/img_mountains_wide.jpg
"
>

div
>

div
>



<
a

class
=
"
carousel-control-prev
"

href
=
"
#demo
"

data-slide
=
"
prev
"
>

<
span

class
=
"
carousel-control-prev-icon
"
>
span
>

a
>

<
a

class
=
"
carousel-control-next
"

href
=
"
#demo
"

data-slide
=
"
next
"
>

<
span

class
=
"
carousel-control-next-icon
"
>
span
>

a
>

div
>

尝试一下 »

轮播图片上添加描述

在每个