51可用代码模板网站

咨询热线:

181-1164-6936
  • 1
CSS样式
当前位置:首页>实用代码>CSS样式>

使用transform和transition制作CSS3动画

时间:2017-08-15 10:30点击:

代码如下



<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>使用transform和transition制作CSS3动画</title>
<style>
ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input{margin:0; padding:0;}
/* HTML ELEMENTS */
body { background-color:#deddcd; font:14px/21px Arial,Helvetica,sans-serif; }
h1 { font: bold 65px/60px Helvetica, Arial, Sans-serif; text-align: center; color: #eee; text-shadow: 0px 2px 6px #333; }
h1 small{ font-size: 20px; text-transform:uppercase; letter-spacing: 14px; display: block; color: #000; }
h2 a { display: block; text-decoration: none; margin: 0 0 30px 0; font: italic 45px Georgia, Times, Serif;  text-align: center;
 color: #bfe1f1; text-shadow: 0px 2px 6px #333; }
h2 a:hover { color: #90bcd0; }
/* COMMON CLASSES */
.break { clear:both; }
/* WRAPPER */
#wrapper { width:960px; margin:40px auto; }
/* CONTENT */
#content { }
#content .info { padding:10px; }
/* MOVIE POSTERS */
#movieposters { list-style:none; margin:100px 0; height:550px; }
#movieposters li { display:inline; float:left;
-webkit-perspective: 500; -webkit-transform-style: preserve-3d;
-webkit-transition-property: perspective; -webkit-transition-duration: 0.5s; }
#movieposters li:hover { -webkit-perspective: 5000; }
#movieposters li img { border:10px solid #fcfafa; -webkit-transform: rotateY(30deg);
-moz-box-shadow:0 3px 10px #888; -webkit-box-shadow:0 3px 10px #888;
-webkit-transition-property: transform; -webkit-transition-duration: 0.5s; }
#movieposters li:hover img { -webkit-transform: rotateY(0deg); }
.movieinfo { border:10px solid #fcfafa; padding:20px; width:200px; height:180px; background-color:#deddcd; margin:-195px 0 0 55px;
 position:absolute;
-moz-box-shadow:0 20px 40px #888; -webkit-box-shadow:0 20px 40px #888;
-webkit-transform: translateZ(30px) rotateY(30deg);
-webkit-transition-property: transform, box-shadow, margin; -webkit-transition-duration: 0.5s; }
#movieposters li:hover .movieinfo { -webkit-transform: rotateY(0deg); -webkit-box-shadow:0 5px 10px #888; margin:-175px 0 0 30px; }
.movieinfo h3 { color:#7a3f3a; font-variant: small-caps; font-family:Georgia,serif,Times; text-align:center; padding-bottom:15px; }
.movieinfo p { padding-bottom:15px; }
.movieinfo a { background-color:#7a3f3a; padding:5px 10px; color:#eee; text-decoration:none; display:block; width:80px; text-align:center;
 margin:0 auto;
-moz-border-radius:5px; -webkit-border-radius:5px; }
.movieinfo a:hover, .movieinfo a:focus { background-color:#6a191f; color:#fff; }
</style>


</head>
<body>
<div id="wrapper">
<ul id="movieposters">
<li>
<img src="/uploads/allimg/170815/102950I34-0.jpg" alt="Iron Man 2" />
<div class="movieinfo">
<h3>Iron Man 2</h3>
<p>With the world now aware of his dual life as the armored superhero Iron Man, billionaire inventor Tony...</p>
<a href="#" title="Iron Man 2">More info</a>
</div>
</li>
<li>
<img src="/uploads/allimg/170815/102950I34-0.jpg" alt="The Last Airbender" />
<div class="movieinfo">
<h3>The Last Airbender</h3>
<p>The story follows the adventures of Aang, a young successor to a long line of Avatars, who must put his...</p>
<a href="#" title="Iron Man 2">More info</a>
</div>
</li>
<li>
<img src="/uploads/allimg/170815/102950I34-0.jpg" alt="Tron Legacy" />
<div class="movieinfo">
<h3>Tron Legacy</h3>
<p>Sam Flynn, the tech-savvy 27-year-old son of Kevin Flynn, looks into his father's disappearance and finds...</p>
<a href="#" title="Tron Legacy">More info</a>
</div>
</li>
 </ul>
</div>
</div>
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F7b1b0a3f92f550c351b60c95bab723a4'
 type='text/javascript'%3E%3C/script%3E"));
</script>
</body>
</html> 



51可用模板(代码)网站专为广大站长朋友提供精品模板与代码,同时免费提供网站收录。
本站域名: WWW.51KYDM.COM    联系方式:QQ:182468923    手机:18111646936
本站关键词:网站链接收录网址收录入口网站免费提交收录网站收录提交入口    网站地图
51可用模板
展开