创新互联Bootstrap5教程:Bootstrap5轮播

Bootstrap5 轮播

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

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:空间域名、网站空间、营销软件、网站建设、察布查尔锡伯网站维护、网站推广。

如何创建轮播

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

实例



<
div

id
=
"
demo
"

class
=
"
carousel slide
"

data-bs-ride
=
"
carousel
"
>



<
div

class
=
"
carousel-indicators
"
>

<
button

type
=
"
button
"

data-bs-target
=
"
#demo
"

data-bs-slide-to
=
"
0
"

class
=
"
active
"
>
button
>

<
button

type
=
"
button
"

data-bs-target
=
"
#demo
"

data-bs-slide-to
=
"
1
"
>
button
>

<
button

type
=
"
button
"

data-bs-target
=
"
#demo
"

data-bs-slide-to
=
"
2
"
>
button
>

div
>



<
div

class
=
"
carousel-inner
"
>

<
div

class
=
"
carousel-item active
"
>

<
img

decoding
=
"
async
"

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

class
=
"
d-block
"

style
=
"
width:100%
"
>

div
>

<
div

class
=
"
carousel-item
"
>

<
img

decoding
=
"
async
"

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

class
=
"
d-block
"

style
=
"
width:100%
"
>

div
>

<
div

class
=
"
carousel-item
"
>

<
img

decoding
=
"
async
"

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

class
=
"
d-block
"

style
=
"
width:100%
"
>

div
>

div
>



<
button

class
=
"
carousel-control-prev
"

type
=
"
button
"

data-bs-target
=
"
#demo
"

data-bs-slide
=
"
prev
"
>

<
span

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

button
>

<
button

class
=
"
carousel-control-next
"

type
=
"
button
"

data-bs-target
=
"
#demo
"

data-bs-slide
=
"
next
"
>

<
span

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

button
>

div
>

尝试一下 »

轮播图片上添加描述

在每个