您的位置:首页 > 其它

幽灵按钮的实现

2016-05-01 20:10 357 查看
话不多说直接上源码

这里我没有重新创建一个新的css样式  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

</head>

<!-- -->

<style>

* {
margin: 0;
padding: 0;

}

body {
background: #333

}

/*整个界面的盒子属性*/

.box {
width: 1000px;
height: 280px;
margin: 50px auto;

}

/* 大盒子中的一个小盒子的默认属性*/

.box .link {
width: 205px;
height: 280px;
margin: 0 20px;
float: left;

}

/*小盒子中默认图标的属性*/

.link .icon {
display: inline-block;
width: 100%;
height: 190px;
transition: all 0.5s linear;
-webkit-transform: 0.2s linear;
-o-transform: 0.2s linear;

}

/* 小盒子中的miss 盒子的属性*/

.link-miss .icon {
background: url(mission.png) no-repeat center center

}

/*所有小盒子中图标的点击动画属性*/

.link .icon:hover {
transform: rotate(360deg);
transform: scale(1, 2);
transform: none;
/*ie 兼容*/
-ms-transform: rotate(360deg) scale(1, 1.5)

}

/* 所有的button属性*/

.button {
padding-left: 15px;
margin: 0 auto;
display: block;
width: 180px;
height: 50px;
text-decoration: none;
line-height: 50px;
color: #999;
font-family: "微软雅黑";
font-weight: bolder;
border: 2px solid #CCC;
box-sizing: border-box;
background: url(allow.png) no-repeat 130px center;
transform: 0.4s ease;
position: relative;

}

/*点击button时的属性*/

.button:hover {
border: 2px solid #999;
background-position: 150px center

}

/*点击button时线的属性 */

.button:hover .line {
background: #0F0;

}

/*通用线的属性*/

.button .line {
display: block;
position: absolute;
background: none;
transition: all 0.5s linear;
-webkit-transform: 0.2s linear;
-o-transform: 0.2s linear;

}

/*top 线的属性*/

.button .line-top {
height: 2px;
width: 180px;
left: -110%;
top: -2px;

}

/*top 线段     点击的动画效果*/

.button:hover .line-top {
width: 100%+2px;
left: -2px;

}

/*bottom*/

.button .line-bottom {
width: 180px;
height: 2px;
right: -110%;
bottom: -2px;

}

.button:hover .line-bottom {
width: 100%+2px;
right: -2px;

}

/*left动画设计*/

.button .line-left {
width: 2px;
height: 0px;
left: -2px;
bottom: -110%;

}

.button:hover .line-left {
height: 105%;
bottom: -2px;

}

/*right*/

.button .line-right {
width: 2px;
height: 0;
right: -2px;
top: -100%;

}

.button:hover .line-right {
height: 105%;
top: -2px;

}

</style>

<body>

<div class="box">
<div class="link link-miss"> 
<span class="icon"></span> 
<a href="#" class="button">
MISSION 
<span class="line line-top"></span> 
<span class="line line-left"></span>
<span class="line line-right"></span> 
<span class="line line-bottom"></span> 
</a> 
</div>

</div>

</body>

</html>

这里面有两张图哦   



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: