1、CSS3新增的样式(常用)

//颜色透明表示
rgba(0,0,0,.5) //圆角(定义角半径)
border-radius: 5px 10px 15px 20px; //文字/盒子阴影
text-shadow: 2px 3px 3px #000; //x方向,y方向,模糊半径,颜色(可定义多个阴影)
box-shadow: (inset) 2px 3px 3px #000; //内阴影,x方向,y方向,模糊半径,颜色(可多个阴影) //线性/径向渐变(没有纳入标准,需加浏览器内核前缀)
background-image: -linear/radial-gradient(left/left top/deg,#ccc,#000,red 50%,...);//起始方向,渐变的颜色(颜色占用的百分比)
background-image: -repeating-linear/radial-gradient(#ace 32%, #f96 36%); //重复渐变,不定方向默认90deg

以上样式比较简单易用,不过细心用起来会发现可以实现很多很意料之外的效果,很强大的。以后遇到其他什么3D效果、渐变突出button,金属文字效果什么的,以上代码便可以实现。随便举个简单的 模拟按钮button 应用,e.g:

//HTML
<div class="box"><a href="">btn</a></div> //CSS
.box a {
display: block;
width: 250px;
color: #fff;
  font-size: 70px;
line-height: 1.5em;
margin: 30px auto;
text-decoration: none;
border: 1px solid rgba(0,0,0,.3);
//这部分是CSS3应用
border-radius: 5px;
text-shadow: 1px 1px 0 rgba(0,0,0,.4);
box-shadow: 0 0 1px rgba(0,0,0,.4);
background-image: -webkit-linear-gradient(90deg,#eaeaea,#c5c5c5); //webkit内核浏览器才能识别
}
.box a:hover {
background-image: -webkit-linear-gradient(-90deg,#eaeaea,#c5c5c5);
}

2、CSS3的变形:transform (需前缀,请自行添加)

rotate(30deg)  //旋转
translate(x,y)/translateX(x)/translateY(y) //平移(x/y轴平移)
scale(x,y)/scaleX(x)/scaleY(y) //缩放
skew(x,y)/skewX(x)/skewY(y) //扭曲 //重定义变形的基点,以上属性都有其默认基点
transform-origin: x y; //定义多个属性
transform: rotate(30deg) scale(0.8,1.5) skew(30deg,-20deg);

3、CSS3的过渡变换:transition (需前缀,请自行添加)

//以下省略了前缀-transition
-property: name; //变换的属性名
-duration: time; //持续时间
-timing-function:
ease //默认,逐步变慢
linear //匀速
ease-in/out //加速/减速
ease-in-out //先加再减速
cubic-bezier(x1,y1,x2,y2) //自定义时间贝塞尔曲线
-delay: time; //推迟时间 //定义多个变换
transition: all .5s ease-in-out 1s;

参考:http://www.css88.com/archives/5403

4、CSS3动画制作:animation(keyframes) (需前缀,请自行添加)

首先,定义关键帧keyframes,学过flash动画的应该就很明白这个概念了

//百分比定义时间段
@keyframes name {
0% {属性状态}
10% {属性状态}
70% {属性状态}
100% {属性状态}
}
//从开始到结束的定义
@keyframes name {
from {属性状态}
to {属性状态}
}

然后,定义动画animation,大部分属性和transition的属性一样的,就没写的太详细了。

//以下省略了前缀-animation
-name: name; //动画名(关键帧的名称)
-duration: time; //持续时间
-timing-function: linear; //动画的时间曲线
-delay: time; //推迟时间
-iteration-count: infinite; //为数字,infinite指无限次
-direction: //动画方式
normal //默认值
alternate //奇数次时反方向执行动画
-play-state: running/paused; //动画状态:播放/停止 //定义多个属性
animate: name 3s ease-in-out 2s infinite alternate;

最新文章

  1. asp.net配置web.config支持jQuery.Uploadify插件上传大文件
  2. 【python】题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?
  3. ERDAS文件格式:IGE、IMG、RRD、AUX
  4. This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
  5. sqldatasource控件设置where语句
  6. 向量和矩阵的范数及MATLAB调用函数
  7. 如何设置DNS的SPF记录
  8. Class diagrams
  9. [iOS微博项目 - 2.2] - 在app中获取授权
  10. jQuery简介&lt;思维导图&gt;
  11. WF4.0 基础篇 (十八) Flowchar
  12. 【HTML】Beginner1:TagsAttributesElements
  13. Linux screen命令简介
  14. ubuntu 下 github 使用方法 以及异常修改
  15. Android下EditText中的字体不统一问题
  16. 缩进(Python很将就格式)
  17. 百叶窗特效(用move.js库)
  18. php调去存储过程
  19. Git基础命令的使用
  20. c#把汉字转化成全拼音函数(全拼)

热门文章

  1. 【android】ImageView的src和background以及两者之间的神奇的差异
  2. centos5.8本地安装yum资源,安装软件包
  3. hdu 5073 Galaxy(2014acm鞍山亚洲分部 D)
  4. centos 之7zip
  5. app后端设计(0)--总文件夹
  6. Android NDK的C++11标准支持
  7. zoj 3822 Domination(dp)
  8. oracle 电子商务解决方案讲义
  9. 【phpMyAdmin】更改配置文件连接到其他server
  10. POI导出大量数据的简单解决方案(附源码)-Java-POI导出大量数据,导出Excel文件,压缩ZIP(转载自iteye.com)