利用CSS3實(shí)現(xiàn)開(kāi)門效果實(shí)例源碼
發(fā)布時(shí)間:2016-08-22 17:54:51 作者:佚名
我要評(píng)論

這篇文章介紹的是利用CSS3實(shí)現(xiàn)當(dāng)鼠標(biāo)移動(dòng)到門上會(huì)自動(dòng)開(kāi)門,當(dāng)鼠標(biāo)移開(kāi)后會(huì)自動(dòng)關(guān)閉門的效果,實(shí)現(xiàn)以后效果很贊,有需要的可以參考借鑒。
先來(lái)看看效果圖
以下實(shí)例源碼
復(fù)制代碼
代碼如下:<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>css3開(kāi)門</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>
總結(jié)
以上就是利用CSS3實(shí)現(xiàn)開(kāi)門效果的全部?jī)?nèi)容,剛興趣的朋友們自己動(dòng)手試試看效果,希望本文對(duì)大家學(xué)習(xí)使用CSS3能有所幫助。
相關(guān)文章
純CSS3實(shí)現(xiàn)圖片無(wú)間斷輪播效果
圖片輪播效果在各大網(wǎng)站都能用到,本文給大家分享通過(guò)純css3制作輪播效果圖的思路,感興趣的朋友一起看看吧2016-08-25CSS3利用text-shadow屬性實(shí)現(xiàn)多種效果的文字樣式展現(xiàn)方法
下面小編就為大家?guī)?lái)一篇CSS3利用text-shadow屬性實(shí)現(xiàn)多種效果的文字樣式展現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-08-25- 本特效是一款使用純CSS3制作的單頁(yè)切換導(dǎo)航菜單界面設(shè)計(jì)效果的代碼。導(dǎo)航按鈕時(shí),相應(yīng)的頁(yè)面會(huì)從屏幕右側(cè)滑動(dòng)出來(lái)2016-08-24
CSS3實(shí)現(xiàn)鼠標(biāo)懸停顯示擴(kuò)展內(nèi)容
本文給大家分享css3代碼實(shí)現(xiàn)鼠標(biāo)懸停顯示要擴(kuò)展的內(nèi)容,在空間過(guò)于擁擠時(shí)需要隱藏部分內(nèi)容使用此功能比較好,下面小編給帶來(lái)了具體實(shí)現(xiàn)代碼,一起看看吧2016-08-24- 本特效是一款使用純CSS3制作的超酷文章卡片UI設(shè)計(jì)效果的代碼。帶有陰影效果,描述信息會(huì)以滑動(dòng)動(dòng)畫(huà)的方式出現(xiàn)2016-08-23
- 本特效是一款使用CSS3制作的垂直列表面板設(shè)計(jì)效果的代碼??捎糜谥谱魑恼铝斜?,排行列表等,歡迎下載使用2016-08-22
CSS3繪制六邊形的簡(jiǎn)單實(shí)現(xiàn)
下面小編就為大家?guī)?lái)一篇CSS3繪制六邊形的簡(jiǎn)單實(shí)現(xiàn)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-08-25