利用CSS3实现开门效果实例源码
脚本之家
先来看看效果图
以下实例源码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>css3开门</title>
<style type="text/css">
.door{ position:relative; width:400px; height:300px; overflow:hidden; border:2px solid #000; background:#000;}
.door:before,.door:after{ content:''; position:absolute; left:0; width:0; height:0; overflow:hidden; border-color:#000 transparent transparent transparent; border-style:solid; border-width:0 200px; z-index:2; transition:all .8s ease;}
.door:before{ top:0;}
.door:after{ bottom:0; border-color:transparent transparent #000 transparent;}
.door:hover:before,.door:hover:after{ border-width:40px 200px;}
.door-left, .door-right{ position:relative; float:left; width:50%; height:100%; background: #64DE27; box-sizing:border-box; transition:all .5s ease;}
.door-left{ border-right:2px solid #000; -webkit-transform-origin:0 0;}
.door-left:before,.door-right:before{ content:''; position:absolute; width:10px; height:10px; top:50%; margin-top:-5px; border-radius:50%; background:#000;}
.door-left:before{ right:5px;}
.door-right:before{ left:5px;}
.door-right{ border-left:2px solid #000; -webkit-transform-origin:100% 0;}
.door:hover .door-left{ -webkit-transform:rotateY(-90deg); transition:transform 2s Linear}
.door:hover .door-right{ -webkit-transform:rotateY(90deg); transition:transform 2s Linear}
</style>
</head>
<body>
<div class="door">
<div class="door-left">1</div>
<div class="door-right">1</div>
</div></p> <p><script type="text/javascript">
</script>
</body>
</html>
总结
以上就是利用CSS3实现开门效果的全部内容,刚兴趣的朋友们自己动手试试看效果,希望本文对大家学习使用CSS3能有所帮助。