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基础

更新时间:2014年10月

transition-timing-function(指定过渡效果的速度曲线)

transition-timing-function:ease/linear/ease-in/ease-out/ease-in-out/cubic-bezier/initial/inherit;

transition-timing-function: linear;

所谓的时间过渡效果,就是一种样式变化到另一种样式。之前一般使用flash或Javascript实现。

css3中,通过使用transition属性就可以实现。

transition-timing-function指定过渡效果的速度曲线。默认值为ease。

与该属性一起的还有transition-delay属性用于指定过渡效果的开始时间, transition-duration属性用于完成过渡效果需要的时间段, transition-property属性用于指定适用时间过渡效果的css属性。这4个属性共同实现时间过渡效果。

也可以使用transition属性总体指定4个属性的值。

transition-timing-function的值及其说明
属性 说明
transition-timing-function ease 开始缓慢变化,中途加速,最终以减速结束。
等同于cubic-bezier(0.25,0.1,0.25,1)
linear 以一定的速度发生变化
等同于cubic-bezier(0,0,1,1)
ease-in 开始缓慢变化,最后加速
等同于cubic-bezier(0.42,0,1,1)
ease-out 开始高速变化,之后慢慢减速直到结束
等同于cubic-bezier(0,0,0.58,1)
ease-in-out 开始缓慢变化,又逐渐加速,最后又减速直到结束
等同于cubic-bezier(0.42,0,0.58,1)
cubic-bezier(n,n,n,n) 使用cubic-bezier函数定义自己的值,值为0~1之间的数值
initial 保持原有属性的值。
inherit 继承母元素的设定。
默认值:ease
使用对象:所有元素、:before伪类元素、:after伪类元素
值的继承:不继承

使用例

.sample1,.sample2,.sample3,.sample4,.sample5,.sample6 {

background-color:#ff0033;

width:200px;

height:50px;

transition: background-color 3s,width 3s;/* Standard syntax */

-moz-transition:background-color 3s,width 3s;/* For Firefox 4.0 to 15.0 */

-webkit-transition-property:background-color 3s,width 3s; /* For Safari 3.1 to 6.0 */

-o-transition-property:background-color 3s,width 3s; /* For Opera10.5 to 12.0*/

}

.sample1{

transition-timing-function: linear;

-moz-transition-timing-function: linear;

-webkit-transition-timing-function: linear;

-o-transition-timing-function: linear;

}

.sample2{

transition-timing-function: ease;

-moz-transition-timing-function: ease;

-webkit-transition-timing-function: ease;

-o-transition-timing-function: ease;

}

.sample3{

transition-timing-function: ease-in;

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

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

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

}

.sample4{

transition-timing-function: ease-out;

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

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

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

}

.sample5{

transition-timing-function: ease-in-out;

-moz-transition-timing-function: ease-in-out;

-webkit-transition-timing-function: ease-in-out;

-o-transition-timing-function: ease-in-out;

}

.sample6{

transition-timing-function: cubic-bezier(0.25,0.1,0.25,1);

-moz-transition-timing-function:cubic-bezier(0.25,0.1,0.25,1);

-webkit-transition-timing-function: cubic-bezier(0.25,0.1,0.25,1);

-o-transition-timing-function: cubic-bezier(0.25,0.1,0.25,1);

}

.sample1:hover,.sample2:hover,.sample3:hover,.sample4:hover,.sample5:hover,.sample6:hover {

width:400px;

background-color: #ffff33;

}

浏览器上的显示结果↓


linear的使用例
ease的使用例
ease-in的使用例
ease-out的使用例
ease-in-out的使用例
cubic-bezier函数的使用例
X

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

IE10FirefoxChromeSafariOpera
transition-timing-function4.0:-moz-transition-timing-function
16.0:transition-timing-function
4.0:-webkit-transition-timing-function
26.0:transition-timing-function
6.1:transition-timing-function
3.1:-webkit-transition-timing-function
12.1:transition-timing-function
10.5:-o-transition-timing-function