JavaShuo
栏目
标签
使用纯css3实现图片轮播
时间 2019-11-09
标签
使用
css3
css
实现
图片
栏目
CSS
繁體版
原文
原文链接
<!DOCTYPE html
>
<
html
>
<
head
>
<
title
> 飛天网事--纯CSS代码实现图片轮播
</
title
>
<
meta
charset=
"utf-8"
/>
<
meta
name=
"description"
content=
"飛天网事,WEB前端开发,纯css3代码图片轮播,HTML5+CSS3精彩案例"
/>
<
meta
name=
"keywords"
content=
"飛天网事,WEB前端开发,HTML5,CSS3,jQuery,"
/>
<
meta
name=
"author"
content=
"R.tian @eduppp.cn 2015"
>
<
link
rel=
"shortcut icon"
href=
"http://eduppp.cn/images/logo4.gif"
/>
<
link
rel=
"apple-touch-icon"
href=
"http://eduppp.cn/images/logo.gif"
/>
<
style
type=
"text/css"
>
#frame {/*----------图片轮播相框容器----------*/
position: absolute; /*--绝对定位,方便子元素的定位*/
width: 300px;
height: 200px;
overflow: hidden;/*--相框做用,只显示一个图片---*/
border-radius:5px;
}
#dis {/*--绝对定位方便li图片简介的自动分布定位---*/
position: absolute;
left: -50px;
top: -10px;
opacity: 0.5;
}
#dis li {
display: inline-block;
width: 200px;
height: 20px;
margin: 0 50px;
float: left;
text-align: center;
color: #fff;
border-radius: 10px;
background: #000;
}
#photos img {
float: left;
width:300px;
height:200px;
}
#photos {/*---设置总的图片宽度--经过位移来达到轮播效果----*/
position: absolute;z-index:9px;
width: calc(300px * 5);/*---修改图片数量的话须要修改下面的动画参数*/
}
.play{
animation: ma 20s ease-out infinite alternate;/**/
}
@keyframes ma {/*---每图片切换有两个阶段:位移切换和静置。中间的效果能够任意定制----*/
0%,20% { margin-left: 0px; }
25%,40% { margin-left: -300px; }
45%,60% { margin-left: -600px; }
65%,80% { margin-left: -900px; }
85%,100% { margin-left: -1200px; }
}
.num{
position:absolute;z-index:10;
display:inline-block;
right:10px;top:165px;
border-radius:100%;
background:#f00;
width:25px;height:25px;
line-height:25px;
cursor:pointer;
color:#fff;
text-align:center;
opacity:0.8;
}
.num:hover{background:#00f;}
.num:hover,#photos:hover{animation-play-state:paused;}
.num:nth-child(2){margin-right:30px}
.num:nth-child(3){margin-right:60px}
.num:nth-child(4){margin-right:90px}
.num:nth-child(5){margin-right:120px}
#a1:hover ~ #photos{animation: ma1 .5s ease-out forwards;}
#a2:hover ~ #photos{animation: ma2 .5s ease-out forwards;}
#a3:hover ~ #photos{animation: ma3 .5s ease-out forwards;}
#a4:hover ~ #photos{animation: ma4 .5s ease-out forwards;}
#a5:hover ~ #photos {animation: ma5 .5s ease-out forwards;}
@keyframes ma1 {0%{margin-left:-1200px;}100%{margin-left:-0px;} }
@keyframes ma2 {0%{margin-left:-1200px;}100%{margin-left:-300px;} }
@keyframes ma3 {100%{margin-left:-600px;} }
@keyframes ma4 {100%{margin-left:-900px;} }
@keyframes ma5 {100%{margin-left:-1200px;} }
</
style
>
</
head
>
<
body
>
<
div
id=
"frame"
>
<
a
id=
"a1"
class=
"num"
>1
</
a
>
<
a
id=
"a2"
class=
"num"
>2
</
a
>
<
a
id=
"a3"
class=
"num"
>3
</
a
>
<
a
id=
"a4"
class=
"num"
>4
</
a
>
<
a
id=
"a5"
class=
"num"
>5
</
a
>
<
div
id=
"photos"
class=
"play"
>
<
img
src=
"http://eduppp.cn/images/0/1.jpg"
>
<
img
src=
"http://eduppp.cn/images/0/3.jpg"
>
<
img
src=
"http://eduppp.cn/images/0/4.jpg"
>
<
img
src=
"http://eduppp.cn/images/0/5.jpg"
>
<
img
src=
"http://eduppp.cn/images/0/2.jpg"
>
<
ul
id=
"dis"
>
<
li
>中国标志性建筑:天安门
</
li
>
<
li
>中国标志性建筑:东方明珠
</
li
>
<
li
>中国标志性建筑:布达拉宫
</
li
>
<
li
>中国标志性建筑:长城
</
li
>
<
li
>中国标志性建筑:天坛
</
li
>
</
ul
>
</
div
>
</
div
>
</
body
>
</
html
>
《借鉴地址:http://blog.csdn.net/rtian001/article/details/48474677》
css
相关文章
1.
纯CSS3实现轮播图
2.
如何用纯css3实现轮播图
3.
+【CSS3】使用纯css代码实现图片轮播效果
4.
css3 - 纯css实现一个轮播图
5.
纯css3 实现3D轮播图
6.
纯 CSS 实现图片轮播
7.
avalon js+css3实现roundabout 图片轮播
8.
纯CSS实现轮播图
9.
纯JS实现轮播图
10.
纯css实现轮播图
更多相关文章...
•
Markdown 图片
-
Markdown 教程
•
使用Redis和Lua的原子性实现抢红包功能
-
红包项目实战
•
☆基于Java Instrument的Agent实现
•
Java Agent入门实战(一)-Instrumentation介绍与使用
相关标签/搜索
图片轮播图控件
轮播图特效
图片
现学现用
使用
纯纯
现用
实现
现实
CSS
红包项目实战
SQLite教程
Docker教程
应用
0
分享到微博
分享到微信
分享到QQ
每日一句
每一个你不满意的现在,都有一个你没有努力的曾经。
最新文章
1.
深度学习硬件架构简述
2.
重温矩阵(V) 主成份分析
3.
国庆佳节第四天,谈谈我月收入增加 4K 的故事
4.
一起学nRF51xx 23 - s130蓝牙API介绍
5.
2018最为紧缺的十大岗位,技术岗占80%
6.
第一次hibernate
7.
SSM项目后期添加数据权限设计
8.
人机交互期末复习
9.
现在无法开始异步操作。异步操作只能在异步处理程序或模块中开始,或在页生存期中的特定事件过程中开始...
10.
微信小程序开发常用元素总结1-1
本站公众号
欢迎关注本站公众号,获取更多信息
相关文章
1.
纯CSS3实现轮播图
2.
如何用纯css3实现轮播图
3.
+【CSS3】使用纯css代码实现图片轮播效果
4.
css3 - 纯css实现一个轮播图
5.
纯css3 实现3D轮播图
6.
纯 CSS 实现图片轮播
7.
avalon js+css3实现roundabout 图片轮播
8.
纯CSS实现轮播图
9.
纯JS实现轮播图
10.
纯css实现轮播图
>>更多相关文章<<