幽灵按钮的实现
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>
这里面有两张图哦
这里我没有重新创建一个新的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>
这里面有两张图哦
相关文章推荐
- Struts之OGNL
- Learning How to Learn
- TCP_Wrappers应用级防火墙介绍与配置
- 安装和使用IIS的URL重写工具
- 常用vim命令合集
- 在不看任何数学公式的情况下理解傅里叶分析
- 利用PHP绘图函数实现简单验证码功能
- ZkClient
- 20145337实验四Android开发基础
- 网络安全---linux下的snort系统的安装和规则测试(一)
- 二叉树链式存储的C实现
- Win10预览版之BUG
- 5.前端笔记之jquery部分
- 第16章 GTK+ gnome编程
- 4715 Difference Between Primes 打表
- HDU 4715:Difference Between Primes
- C#并行编程-Parallel
- linux Tomcat7 配置及常见问题
- 汇编中有符号与无符号数以及CF,OF标志位的区分
- ListView组件总结