先预览效果

其中用到了CSS3的Transition属性:设置动画时间、效果;Transform属性:设置元素旋转、位移;box-sizing属性:以特定的方式定义某个区域的特定元素;

制作小三角方法:

1 width:0; height:0; overflow:hidden;
2 border:7px solid transparent;
3 border-top-color:#2dcb70; /*宽高都为零,先设置边框为透明,再在需要的地方给边框单独设置颜色即可*/


HTML代码

 <div class="box">
<div class="link link-miss">
<span class="icon"></span>
<a href="#" class="button" data="My mission is clear">
<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="link link-play">
<span class="icon"></span>
<a href="#" class="button" data="This is my playGroup">
<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="link link-touch">
<span class="icon"></span>
<a href="#" class="button" data="This is my Touch">
<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 class="tip">
<em></em><span></span>
</div>
</div>

CSS代码

 *{margin:;
padding:;} body{background:#333;}
.box {
width:800px; height:280px; margin: 50px auto;
}
.box .link {
width:205px; height:280px; float: left; margin:0 20px;
}
.link .icon {
display:inline-block; width:100%; height:190px; cursor:pointer;
transition:ease-out 0.2s;
}
.link-miss .icon {
background:url(../images/mission.png) no-repeat center;
}
.link-play .icon {
background:url(../images/play.png) no-repeat center;
}
.link-touch .icon {
background:url(../images/touch.png) no-repeat center;
}
.link .icon:hover {
transform:rotate(360deg) scale(1.2);
}
.button {
display:block; width:180px; height:50px; line-height: 50px; text-decoration: none; color:#2dcb70;
font-family: Arial; font-weight: bolder; border:2px solid rgba(255,255,255,0.6);
padding-left: 20px; margin:0 auto; background: url(../images/allow.png) no-repeat 130px center;
box-sizing:border-box;
transition:0.4s ease;
position: relative;
}
.button:hover {
border:2px solid rgba(255,255,255,1);
background-position: 140px center;
}
/*
CSS3--Transition
语法:transition:property duration timing-function delay;
描述:
transition-property:规定设置过渡效果的CSS属性的名称;
transition-duration:规定完成过渡效果需要多少秒或毫秒;
transition-timing-function:规定速度效果的速度曲线;
transition-delay:定义过渡效果何时开始;
CSS3--Transform
transform属性向元素应用2D或3D转换;该属性允许我们对元素进行旋转/缩放/移动或倾斜;
CSS3--box-sizing
box-sizing属性允许以特定的方式定义匹配某个区域的特定元素;
语法:box-sizing:content-box | border-box | inherit;
描述:
content-box:(默认值)宽度和高度分别应用到元素的内容框,在宽度和高度的基础上绘制元素的内边距和边框;
border-box:为元素指定的任何内边距和边框都将在已设定的宽度和高度内进行绘制;
通过已设定的宽度和高度分别减去边框和内边距才能得到内容的实际宽度和高度;
*/
.button .line {
position: absolute; background: none; transition:0.4s;
}
.button:hover .line {
background: #f00;
} .button .line-top {
width:0px; height:2px; top:-2px; left:-110%;
}
.button:hover .line-top {
width:180px; left:-2px;
} .button .line-right {
width:2px; height:0px; right:-2px; top:-110%;
}
.button:hover .line-right {
height:50px; top:-2px;
} .button .line-bottom {
width:0px; height:2px; bottom:-2px; right:-110%;
}
.button:hover .line-bottom {
width:180px; right:-2px;
} .button .line-left {
width:2px; height:0px; left:-2px; bottom:-110%;
}
.button:hover .line-left {
height:50px; bottom:-2px;
}
.tip {
position: absolute; padding: 0 14px; height:35px; line-height: 35px; background: #2dcb70;
color:#fff; font-size: 18px; margin: 0 auto; border-radius: 3px; top:160px; opacity:;
}
.tip em {
font-style: normal; font-size: 18px; color:#fff;
}
.tip span {
display: block; width:; height:; overflow: hidden; position: absolute; top:35px; left:50%;
border:7px solid transparent; border-top-color:#2dcb70; margin-left: -3px;
}

JQuery代码

 $(function(){
$('.link .button').hover(function(){
var title = $(this).attr('data');
$('.tip em').text(title);
var pos = $(this).offset().left;
var dis = parseInt($('.tip').outerWidth()-$(this).outerWidth())/2;
var l = pos - dis;
$('.tip').css({'left':l+'px'}).animate({'top':180,'opacity':1},300);
},function(){
if(!$('.tip').is(':animated')){
$('.tip').animate({'top':160,'opacity':0},50);
}
})
});

学自慕课网http://www.imooc.com/learn/5

CSS3--幽灵按钮特效(实例)的更多相关文章

  1. 7款外观迷人的HTML5/CSS3 3D按钮特效

    1.CSS3超酷3D弹性按钮 按钮实现非常简单 今天我又要向大家分享一款实现超级简单的CSS3 3D弹性按钮,它在鼠标按下时不仅从视觉上感受到3D立体的效果,而且更有弹性的动画特效,非常可爱. 在线演 ...

  2. 5种漂亮的纯CSS3动画按钮特效

    这次我们要来分享一款很不错的CSS3按钮动画,这款CSS3按钮一共有5种动画方式,每一种都是鼠标滑过动画形式,虽然这些动画按钮不是十分华丽,但是小编觉得不像其他按钮那样很难扩展,我们可以修改CSS代码 ...

  3. 7款外观迷人的HTML5/CSS3 3D特效按钮特效

    下面我整理了7款外观都十分迷人的HTML5/CSS3 3D按钮特效,有几个还挺实用的,分享给大家. 1.CSS3超酷3D弹性按钮 按钮实现非常简单 之前我们分享过几款不错的CSS3 3D立体按钮,比如 ...

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

    给大家分享一个听着好像很牛的东西——幽灵按钮,这个玩意对于艺术设计细胞在高中决定不在考试试卷上画画的我来说,实在不感冒.但是这个按钮的设计元素很流行,一个网页东西不做几个,光放上几个按钮就会显得很高端 ...

  5. 纯CSS3实现牛奶般剔透的3D按钮特效

    今天我们要来看一款非常特别的纯CSS3 3D按钮,它的外观酷似纯白剔透的牛奶,点击按钮的时候还会出现一种很柔和的弹力效果.按钮按下时,按钮会轻轻的弹动一下,非常逼真.本文我们在观赏演示的同时,也将源代 ...

  6. 一款纯css3实现的鼠标经过按钮特效

    今天再给大家带来一款纯css3实现的鼠标经过按钮特效.这款按钮非常简单,但效果很好,非常漂亮.一起看下效果图: 在线预览   源码下载 实现的代码. html代码: <div align=&qu ...

  7. css3 javascript 实现菜单按钮特效

    一个菜单按钮特效案例,简单的实现了动态效果. 代码效果预览地址: http://code.w3ctech.com/detail/2504 <div class="bar" i ...

  8. 基于jQuery点击加载动画按钮特效

    分享一款基于jQuery点击加载动画按钮特效.这是一款基于jQuery+CSS3实现的鼠标点击按钮加载动画特效代码.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div ...

  9. 9款经典华丽的CSS3分享按钮

    如果你经常活跃在一些社交网站上,那么你肯定会看到过很多形式各异的分享按钮,目前由于HTML5和CSS3的普及,很多分享按钮也都应用了CSS3样式,甚至会有很多带有动画的CSS3分享按钮.本文就向大家介 ...

随机推荐

  1. 为什么要把js代码写到<!--//-->中

    是为了兼容,不支持js的浏览器会把其中的内容当做html注释.

  2. Oracle 触发器在日志管理开发中的应用

    摘要: 本文讨论了利用数据库中的触发器对日志管理进行设计与实现的方法, 是对原来在客户端软件中编写日志管理方法的一种改进, 并给出了 Oracle9i 中的实例演示.关键词: Oracle; 触发器; ...

  3. PPT美化大师

    PPT美化大师 http://docer.mysoeasy.com/ PPT文档美化大师是一款专门为Office文档优化锦上添花的工具,该软件时尚个性打造出最漂亮的模板,有了这款软件在操作起来也简单许 ...

  4. 用javascript实现简体和繁体字间的转换

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  5. wp8 在OnBackKeyPress事件中调用MessageBox.Show()崩溃

    今天写代码的时候遇到一个问题,在wp8中执行下面的代码后,弹出对话框后,停滞一段时间程序退出. protected override void OnBackKeyPress(CancelEventAr ...

  6. Codeforces Good Bye 2015 D. New Year and Ancient Prophecy 后缀数组 树状数组 dp

    D. New Year and Ancient Prophecy 题目连接: http://www.codeforces.com/contest/611/problem/C Description L ...

  7. GLSL实现Image Filter 【转】

    http://blog.csdn.net/a3070173/archive/2008/11/27/3390477.aspx 图像过滤无论是在作图工具还是特效的实现上都时有运用,这里发一些通常会使用到的 ...

  8. hadoop集群扩展

    一.先改动master机上的host文件,新增内容 10.61.6.180 slaves15 二.改动master机上hadoop安装文件夹下的conf中的slaves文件.新增内容 slaves15 ...

  9. Quartz表达式

    “*”字符代表所有可能的值 因此,“*”在子表达式(月)里表示每个月的含义,“*”在子表达式(天(星期))表示星期的每一天 “/”字符用来指定数值的增量 例如:在子表达式(分钟)里的“0/15”表示从 ...

  10. 0c-35-自动释放池使用注意

    .autorelease使用注意 )并不是放到自动释放池中,都会自动加入到自动释放池 1.1) 因为没有调用autorelease方法,所以对象没有加入到自动释放池. int main(){ @aut ...