幽灵按钮的实现

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了幽灵按钮的实现相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>幽灵按钮</title>
        <style>

* {
padding: 0;
margin: 0;
}

body {
background: url(../img/bizhi.jpeg);
background-size: cover;
}

.content {
width: 1000px;
height: 400px;
margin: 70px auto;
}

.content .box {
width: 205px;
height: 220px;
float: left;
margin: 0 60px;
}

.box .icon {
width: 200px;
height: 200px;
display: block;
margin: 0 auto;
transition: all 0.5s;
-webkit-transition: all 0.5s;
-o-transition: all 0.5s;
-moz-transition: all 0.5s;
}

.box_mission .icon {
background: url(../img/youxiji.png) no-repeat;
}

.box_play .icon {
background: url(../img/huojian.png) no-repeat;
}

.box_touch .icon {
background: url(../img/ditu.png) no-repeat;
}

.box_mission .icon:hover,.box_play .icon:hover,.box_touch .icon:hover {
transform: scale(1.2) rotate(360deg);
-webkit-transform: scale(1.2) rotate(360deg);
-o-transform: scale(1.2) rotate(360deg);
-moz-transform: scale(1.2) rotate(360deg);

}
.box .button{
position: relative;
width: 176px;
height: 45px;
line-height: 45px;
display: block;
margin: 50px auto;
font-family: "微软雅黑";
font-weight: bold;
font-size: 20px;
color:#11cd64;
text-decoration: none ;
padding-left: 10px;
background: url(../img/jiantou.png) no-repeat 125px center;
border: 2px solid rgba(255,255,255,0.7);
transition: all 0.3s;
}
.box .button:hover{
background-position: 140px center;
border: 2px solid rgba(255,255,255,1);
}

.box .line{
background: white;
position:absolute;
display: block;
transition: all 0.4s;
}
/*
设置顶部线条 从左往右过渡到上边框的位置
高度不变 2px
宽度0---》190px
*/
.box .line_top{
width: 0px;
height: 2px;
top: -2px;
left: -100px;
}
.box .button:hover .line_top{
width: 190px;
left: -2px;
}
/*底部线条*/
.box .line_bottom{
width:0;
height: 2px;
bottom: -2px;
right: -100px;
}
.box .button:hover .line_bottom{
width: 190px;
right: -2px;
}
/*左侧*/
.box .line_left{
width:2px;
height: 0;
top: 80px;
left: -2px;
}
.box .button:hover .line_left{
height: 49px;
top: -2px;
}
/*右侧*/
.box .line_right{
width:2px;
height: 0;
bottom: 80px;
right: -2px;
}
.box .button:hover .line_right{
height: 49px;
bottom: -2px;
}


     </style>
</head> <body> <div class="content"> <div class="box box_mission"> <span class="icon"></span> <a href="#" class="button"> <span class="line line_top"></span> <span class="line line_right"></span> <span class="line line_bottom"></span> <span class="line line_left"></span> MISSION </a> </div> <div class="box box_play"> <span class="icon"></span> <a href="#" class="button"> <span class="line line_top"></span> <span class="line line_right"></span> <span class="line line_bottom"></span> <span class="line line_left"></span> PLAY </a> </div> <div class="box box_touch"> <span class="icon"></span> <a href="#" class="button"> <span class="line line_top"></span> <span class="line line_right"></span> <span class="line line_bottom"></span> <span class="line line_left"></span> TOUCH </a> </div> </div> </body> </html>

 

 

以上是关于幽灵按钮的实现的主要内容,如果未能解决你的问题,请参考以下文章

幽灵按钮的实现

CSS3实现幽灵按钮效果图!

幽灵按钮实例

设计趋势:网页设计中的幽灵按钮

幽灵按键

听着好像很牛的特效——幽灵按钮DOM