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属性所设置的高度大小

最新文章

  1. 对rxandroid的简单理解
  2. zoom在css中的作用
  3. 【leetcode】Merge Two Sorted Lists
  4. iOS socket TCP UDP
  5. [JS2] JS是弱类型
  6. ASP.NET Web API中的参数绑定总结
  7. iis启动网站提示 文件正在使用
  8. ***微信浏览器禁止app下载链接怎么办
  9. php缓存小技巧
  10. c++大数模版
  11. 一个页面从输入url到加载完成的过程都发生了什么,请详细说明
  12. 15LaTeX学习系列之---LaTeX里插入数学公式
  13. 利用Costura.Fody制作绿色单文件程序(C#程序(含多个Dll)合并成一个Exe)
  14. 【01月22日】A股滚动市盈率PE最低排名
  15. P2469 [SDOI2010]星际竞速
  16. UE4 IOS 开发之传感器输入
  17. WDA-FPM-3-SEARCH(OIF)
  18. Shell或notepad连接虚拟机操作
  19. Keepalived_vrrp: ip address associated with VRID not present in received packet
  20. ASP.NET Page执行顺序如:OnPreInit()、OnInit()……

热门文章

  1. Codevs 2006=BZOJ 2964 Boss单挑战
  2. 3.myeclipse 8.5 m1 注册码
  3. Latex 3: 解决LaTeX编译卡顿问题
  4. HDU - 4513 吉哥系列故事――完美队形II(manacher)
  5. Lucene dvd dvm文件便是docvalues文件——就是针对field value的列存储
  6. codeforces 682C C. Alyona and the Tree(dfs)
  7. Linux 下的静态(函数)库、动态(函数)库
  8. 并不对劲的bzoj3277
  9. POJ3468:A Simple Problem with Integers (线段树||树状数组||Splay解决基本问题的效率对比)
  10. 【POJ 2152】 Fire