1. 实例

2.HTML 代码

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS3-Fade</title>
<link rel="stylesheet" type="text/css" href="./fade.css">
</head>
<body>
<div class="container">
<div class="fade fade-in">
fade-in
</div>
<div class="fade fade-top">
fade-top
</div>
<div class="fade fade-bottom">
fade-bottom
</div>
<div class="fade fade-left">
fade-left
</div>
<div class="fade fade-right">
fade-right
</div>
<div class="fade bounce-top">
bounce-top
</div>
<div class="fade bounce-bottom">
bounce-bottom
</div>
<div class="fade bounce-left">
bounce-left
</div>
<div class="fade bounce-right">
bounce-right
</div>
<div class="fade fade-center-out">
fade-center-out
</div>
<div class="fade fade-center-in">
fade-center-in
</div>
<div class="fade fade-middle-out">
fade-middle-out
</div>
<div class="fade fade-middle-in">
fade-middle-in
</div>
</div>
</body>
</html>

3.CSS 代码

*{
padding:;
margin:;
}
html{
background: -webkit-radial-gradient(#222222, #000000);
background: radial-gradient(#222222, #000000);
height: 100%;
text-align: center;
width:100%;
} .container{
width: 800px;
margin: 200px auto;
text-align: left;
} .fade{
cursor: pointer;
box-sizing: border-box;
display: inline-block;
color: #09f;
background: white;
padding: 10px 20px;
text-align: center;
margin: 10px 0;
/* 设置相对定位 */
position: relative;
transition: all 0.3s;
/* 设置层次 会被before after在上面 */
z-index:;
} .fade:hover{
color: white;
} /* 其实使用背景颜色变化就可以的 但是这里为了做统一*/
.fade:before,.fade:after
{
display: block;
transition: all 0.3s;
background: #09f;
position: absolute;
content: '';
z-index: -1;
} .fade-left:before,.fade-right:before,
.fade-center-out:before,.fade-center-out:after,
.fade-center-in:before,.fade-center-in:after,
.bounce-left:before,.bounce-right:before
{
height: 100%;
top:;
width:;
} .fade-middle-out:before,.fade-middle-out:after,
.fade-middle-in:before,.fade-middle-in:after,
.bounce-bottom:before
{
height:;
width: 100%;
left:;
} /* 弹跳元素设置时间线 使用三次贝塞尔曲线 */
.bounce-top:before,.bounce-bottom:before,
.bounce-left:before,.bounce-right:before{
transition-timing-function: cubic-bezier(0.52, 1.7, 0.5, 0.4);
} .fade-in:before{
height: 100%;
width: 100%;
opacity:;
top:;
left:;
} .fade-bottom:before, .fade-top:before,.bounce-top:before{
height:;
width: 100%;
left:;
}
.fade-top:before,.bounce-top:before,.fade-middle-out:before{
top:;
} .fade-bottom:before,.fade-middle-out:after,.bounce-bottom:before{
bottom:;
} .fade-left:before,.fade-center-in:before,.bounce-left:before{
left:;
} .fade-right:before,.fade-center-in:after,.bounce-right:before{
right:;
} .fade-center-out:before{
right: 50%
}
.fade-center-out:after{
left: 50%
}
.fade-middle-in:before{
bottom:50%;
}
.fade-middle-in:after{
top:50%;
} .fade-in:hover:before{
opacity:;
} .fade-left:hover:before,.fade-right:hover:before,
.bounce-left:hover:before,.bounce-right:hover:before
{
width: 100%;
} .fade-top:hover:before,.fade-bottom:hover:before,
.bounce-top:hover:before,.bounce-bottom:hover:before{
height: 100%;
} .fade-center-out:hover:before,.fade-center-out:hover:after,
.fade-center-in:hover:before,.fade-center-in:hover:after{
width:50%;
}
.fade-middle-out:hover:before,.fade-middle-out:hover:after,
.fade-middle-in:hover:before,.fade-middle-in:hover:after
{
height:50%;
}

4. 练习

区别只是 heigth属性所设置的高度大小

CSS3 按钮特效(一)的更多相关文章

  1. 神奇的CSS3按钮特效

    点击这里查看效果 以下是源代码: <!doctype html> <html> <!-- author: @simurai --> <head> < ...

  2. 10款CSS3按钮 - 程序员再也不用为按钮设计而发愁了...

    这次主要给大家分享10款风格各异的CSS3按钮,如果你希望你的页面也能有很炫的样式,那么我相信这10款CSS3按钮就非常适合你,而且每一款都整理了源代码供参考,一起来看看吧. 1.绚丽的CSS3发光按 ...

  3. 10款CSS3按钮 - 再也不用为按钮设计而发愁了

    这次主要给大家分享10款风格各异的CSS3按钮,如果你希望你的页面也能有很炫的样式,那么我相信这10款CSS3按钮就非常适合你,而且每一款都整理了源代码供参考,一起来看看吧. 1.绚丽的CSS3发光按 ...

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

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

  5. 6种炫酷的CSS3按钮边框动画特效

    6种炫酷的CSS3按钮边框动画特效Button border animate 用鼠标滑过下面的按钮看看效果! Draw Draw Meet Center Spin Spin Circle Spin T ...

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

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

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

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

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

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

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

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

随机推荐

  1. my-small.cnf my-medium.cnf my-large.cnf my-huge.cnf

    my-small.cnf my-medium.cnf my-large.cnf my-huge.cnf 是 MySQL 默认的几个配置文件.针对不同配置的服务器可以使用不同的配置文件,将你需要的那一个 ...

  2. html2canvas 导出包含滚动条的内容

    import html2canvas from 'html2canvas'; exportPDF() { // 导出为 pdf let dom = document.querySelector('yo ...

  3. 点滴记录——Ubuntu 14.04中Chrome浏览器标题栏出现中文乱码

    今天不知道在系统里装的哪个软件与Chrome浏览器所用的字体向冲突了,导致标题栏显示的中文都变成了乱码,其次收藏栏中的中文也变成了乱码.导致原有的收藏内容都无法辨认了.在网上搜索了一下,也有人遇到了相 ...

  4. [IT学习]GIT 学习

    最近开始了解GIT.有一些不错的资源记录在下面: 1.GIT for teams A book about teams cooperation. 2.GIT https://learngitbranc ...

  5. VS类添加头文件注释

    VS2015参考: http://blog.csdn.net/qq395537505/article/details/50853546  修改两个文件,详细信息 VS2010: 找到VS的安装目录 E ...

  6. myeclipse包的层数和package的层数不一致

    复制别人的工程的时候常常遇到包的层数不一致的情况 如下图 其实com.weibo.happpy.dao的上面还有一层java包,但是代码里没有写java....... 可以通过如下方式修改工程:

  7. AndroidEventBus总结

    什么是AndroidEventBus? android事件总线,是一个发布 / 订阅的事件总线 github地址:https://github.com/greenrobot/EventBus Andr ...

  8. HDU1269 迷宫城堡 —— 强连通分量

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1269 迷宫城堡 Time Limit: 2000/1000 MS (Java/Others)    M ...

  9. I.MX6 PLL5 clock hakcing

    /************************************************************************** * I.MX6 PLL5 clock hakci ...

  10. bzoj1046 [HAOI2007]上升序列——LIS

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1046 倒序求最长下降子序列,则得到了每个点开始的最长上升子序列: 然后贪心输出即可. 代码如 ...