CSS

选择器

css中的选择器

背景颜色、图像

background background-attachment background-clip background-color background-image background-origin backgrond-position background-repeat background-size

文字、字体

color font font-family font-size font-size-adjust font-style font-variant font-weight

文档格式

hanging-punctuation hyphens letter-spacing line-height text-align text-decoration text-indent text-overflow text-shadow text-transform white-space word-spacing word-wrap

宽度和高度

width,height max-width min-width max-height min-height

外缘与内缘余白

margin margin-bottom margin-left margin-right margin-top padding padding-bottom padding-left padding-right padding-top

边框

border border-bottom border-color border-style border-width border-top border-right border-left

边框圆角

border-radius border-bottom-right-radius border-bottom-left-radius border-top-right-radius border-top-left-radius

边框图像

border-image border-image-repeat border-image-slice border-image-source border-image-width

容器与弹性容器

bottom clear clip box-decoration-break box-shadow align-content align-items align-self display flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap justify-content float left outline-offset overflow overflow-x overflow-y order position right resize top vertical-align z-index

透明

opacity rgba

渐变

linear-gradient radial-gradient

文章分栏

break-after break-before break-inside columns column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width

时间过渡效果

transition transition-delay transition-duration transition-property transition-timing-function

动漫效果

@keyframes animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function

2D、3D变形

transform translate matrix2d matrix3d perspective scale skew rotate transform-origin

颜色、尺寸、单位

角度与URL 颜色 单位长度

表格

border-collapse border-spacing caption-side empty-cells table-layout

列表

counter-increment counter-reset list-style list-style-type list-style-image list-style-position

基本的用户界面属性

box-sizing content cursor nav-index nav-left nav-down nav-right nav-up

CSS基础

animation-timing-function(定义动画的速度曲线)

animation-timing-function: linear/ease/ease-in/ease-out/cubic-bezier(n,n,n,n)/initial/inherit;

animation-timing-function: ease;

使用animation-timing-function属性定义动画的速度曲线。

用速度曲线定义动画从一种css样式到另一种css样式的变化时间。

速度曲线用于使变化趋于平滑。

animation-timing-function的值及其说明
说明
linear 指定动画以一定的速度运行
ease 指定动画开始缓慢,中途加速,最终以减速结束
ease-in 指定动画以缓慢运行开始
ease-out 指定动画以缓慢运行结束
ease-in-out 指定动画开始缓慢运行,又逐渐加速,最后又减速直到结束
cubic-bezier(n,n,n,n) 使用cubic-bezier函数定义自己的值,值为0~1之间的数值
initial 保持原有属性的值
inherit 继承母元素的设定。
默认值:ease
使用对象:块元素和直列元素
值的继承:不继承
JavaScript语法: object.style.animationTimingFunction="linear"

使用例

.sample1,.sample2,.sample3,.sample4 {

margin:2px;

width:250px;

height:100px;

background:#00ffff;

position:relative;

-moz-animation:anim1 5s;

-webkit-animation:anim1 5s;

-o-animation:anim1 5s;

animation:anim1 5s;

}

.sample1{

-moz-animation-timing-function:linear;

-webkit-animation-timing-function:linear;

-o-animation-timing-function:linear;

animation-timing-function:linear;

}

.sample2{

-moz-animation-timing-function:ease;

-webkit-animation-timing-function:ease;

-o-animation-timing-function:ease;

animation-timing-function:ease;

}

.sample3{

-moz-animation-timing-function:ease-in;

-webkit-animation-timing-function:ease-in;

-o-animation-timing-function:ease-in;

animation-timing-function:ease-in;

}

.sample4{

-moz-animation-timing-function:ease-out;

-webkit-animation-timing-function:ease-out;

-o-animation-timing-function:ease-out;

animation-timing-function:ease-out;

}

@-moz-keyframes anim1 {

from{left:0px;background-color:red;}

to {left:250px;}

}

@-webkit-keyframes anim1 {

from{left:0px;background-color:red;}

to {left:250px;}

}

@-o-keyframes anim1 {

from{left:0px;background-color:red;}

to {left:250px;}

}

浏览器上的显示结果↓


animation-iteration-count:none;
animation-iteration-count:forwards;
animation-iteration-count:backwards;
animation-iteration-count:both;

不同浏览器上的属性的书写方法及对应情况

属性
animationName 10.0 43.0
4.0 -webkit-
16.0
5.0 -moz-
9.0
4.0 -webkit-
30.0
15.0 -webkit-
12.0 -o-

注:表中的数字为浏览器的版本代号,从所指版本开始支持该属性。Webkit、Moz、-o-表示开始使用Webkit、Moz、-o-前缀的浏览器版本。

关联内容