码迷,mamicode.com
首页 > Web开发 > 详细

CSS实现轮播效果

时间:2017-09-24 23:25:53      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:opacity   inf   做了   oct   ase   css3   charset   disco   highlight   

还没有学习如何用JS实现轮播图效果,所以就用CSS做了一个假的~

氮素!目前只调出三个图实现轮播,图越多代码就越复杂,后面就没调了,才不是因为我懒_(:з」∠)_

代码如下↓↓↓

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<style>
	img[alt="02"]{
		position: absolute;
		animation: op_02 20s ease-in-out infinite;
	}
	img[alt="01"]{
		position: absolute;
		animation: op_01 10s ease-in-out infinite;
	}
	@keyframes op_01{
		30%{
			opacity: 1;
		}
		70%{
			opacity: 0;
		}
		100%{
			opacity: 1;
		}
	}
	@keyframes op_02{
		0%{
			opacity: 1;
		}
		30%{
			opacity: 0;
		}
	}
</style>
<body>
	<img src="app_discover_4_05_033_03.png" alt="01">
	<img src="app_discover_4_07.png" alt="02">
	<img src="app_discover_4_12.png" alt="03">
</body>
</html>

  关键点就在于利用opacity属性控制图片在何时变为透明又何时出现,原理很简单吧~ CSS3真的超级强大了~

CSS实现轮播效果

标签:opacity   inf   做了   oct   ase   css3   charset   disco   highlight   

原文地址:http://www.cnblogs.com/tortoises/p/7589050.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!