css3开门效果
css3瞎捣鼓,弄个开门的小效果,只针对webkit内核浏览器,最好用谷歌打开,其他高级浏览器的兼容代码就没写了
1 .door{ position:relative; width:400px; height:300px; overflow:hidden; border:2px solid #000; background:#000;} 2 .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;} 3 .door:before{ top:0;} 4 .door:after{ bottom:0; border-color:transparent transparent #000 transparent;} 5 .door:hover:before,.door:hover:after{ border-width:40px 200px;} 6 .door-left, .door-right{ position:relative; float:left; width:50%; height:100%; background:#f00; box-sizing:border-box; transition:all .5s ease;} 7 .door-left{ border-right:2px solid #000; -webkit-transform-origin:0 0;} 8 .door-left:before,.door-right:before{ content:‘‘; position:absolute; width:10px; height:10px; top:50%; margin-top:-5px; border-radius:50%; background:#000;} 9 .door-left:before{ right:5px;} 10 .door-right:before{ left:5px;} 11 .door-right{ border-left:2px solid #000; -webkit-transform-origin:100% 0;} 12 .door:hover .door-left{ -webkit-transform:rotateY(-90deg);} 13 .door:hover .door-right{ -webkit-transform:rotateY(90deg);}
1 <div class="door"> 2 <div class="door-left"></div> 3 <div class="door-right"></div> 4 </div>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。