好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

css3伦播图

CSS3伦播图是一种实现网页动态展示的重要技术,它可以用CSS3的属性和特效来实现图片的滑动和切换,让网页更加生动有趣。

实现CSS3伦播图需要用到以下代码:

.banner{
width: 800px;
height: 400px;
overflow: hidden;
position: relative;
}
.banner ul{
list-style: none;
position: relative;
}
.banner li{
width: 800px;
height: 400px;
float: left;
position: relative;
}
.banner .num{
position: absolute;
right: 20px;
bottom: 20px;
z-index: 999;
}
.banner .num ul{
list-style: none;
}
.banner .num li{
float: left;
margin-left: 20px;
font-size: 24px;
color: #fff;
cursor: pointer;
}
.banner .num li.on{
color: red;
}

在这里,我们设置了一个类名为“banner”的div容器,它是图片轮播图的父容器,我们可以通过它来控制轮播图的整体样式和布局。

其次,我们利用“ul”和“li”标签来实现图片的切换和滑动,其中“ul”代表图片的容器,每个“li”代表一张轮播图片,通过设置“li”的position为“relative”和float为“left”,就可以实现图片的水平排列。

最后,我们添加了“num”类名,通过它可以实现轮播图下方的数字标记。在“num”类中,我们设置了右侧、底部的距离和z-index属性,用来控制数字标记的显示位置和层级。并在数字标记中使用了“on”类名,并设置了红色字体颜色,来表示当前轮播的图片,使用户更容易识别。

查看更多关于css3伦播图的详细内容...

  阅读:46次

上一篇: css3做圆角

下一篇:css3入门书推荐