本篇文章给大家分享的是有关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中怎么实现开门效果,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注编程网行业资讯频道。