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(总体指定动画属性)

animation: name duration timing-function delay iteration-count direction fill-mode play-state;

animation: anim1 5s ease 2s infinite alternate;

使用animation属性总体指定动漫属性,值之间用半角空格间隔,且值的顺序任意。

animation的值及其说明
说明
animation-name 指定使用的动画的keyframe名称
animation-duration 指定动画的运行时间
animation-timing-function 指定动画的速度曲线
animation-delay 指定动画的的开始时间
animation-iteration-count 指定动画的运行次数
animation-direction 动画反复运行时,指定是否反向播放
animation-fill-mode 指定动画不运行时的状态
animation-play-state 指定动画是运行还是暂停,默认值为“running”
initial 保持原有属性的值
inherit 继承母元素的设定。
默认值:none 0 ease 0 1 normal none running
使用对象:块元素和直列元素
值的继承:不继承
JavaScript语法: object.style.animation="mymove 5s infinite"

使用例

.sample1 {

-moz-animation: anim1 5s ease 2s infinite alternate;

-webkit-animation: anim1 5s ease 2s infinite alternate; /* Chrome, Safari, Opera */

-o-animation: anim1 5s ease 2s infinite alternate;

animation: anim1 5s ease 2s infinite alternate;

}

@-moz-keyframes anim1 {

0% {width: 80px; height: 80px; background-color: #9933FF;}

100% {width: 200px; height: 80px; background-color: #CCFF99;}

}

@-webkit-keyframes anim1 {

0% {width: 80px; height: 80px; background-color: #9933FF;}

100% {width: 200px; height: 80px; background-color: #CCFF99;}

}

@-o-keyframes anim1 {

0% {width: 80px; height: 80px; background-color:#9933FF;}

100% {width: 200px; height: 80px; background-color:#CCFF99;}

}

@-ms-keyframes anim1 {

0% {width: 80px; height: 80px; background-color:#9933FF#;}

100% {width: 200px; height: 80px; background-color: #CCFF99;}

}

浏览器上的显示结果↓


使用animation的效果

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

IE10FirefoxChromeSafariOpera
animation5.0:-moz-animation
16.0:animation
4.0:-webkit-animation15.0:-webkit-animation12.10:animation
12.0:-o-animation

note:表中的数字为浏览器的版本代号,从所指版本开始支持该属性。带有-webkit-的数字为该当属性添加-webkit-前缀后开始支持的浏览器版本。

关联内容