利用CSS3实现开门效果实例源码
网站建设 2021-07-03 08:15www.dzhlxh.cn网站建设
先来看看效果图
以下实例源码
复制代码
代码如下:<!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能有所帮助。
上一篇:CSS3实现鼠标悬停显示扩展内容
下一篇:浅谈css和@import区别及用法