CSS 动画
定义和用法
一些 CSS 属性是可以有动画效果的,这意味着它们可以用于动画和过渡。
动画属性可以逐渐地从一个值变化到另一个值,比如尺寸大小、数量、百分比和颜色。
浏览器支持
表格中的数字表示支持该方法的第一个浏览器的版本号。
紧跟在数字后面的 -webkit-, -moz-, 或 -o- 指定了第一个支持该属性的浏览器版本前缀。
| 4.0 -webkit- | 10.0 | 16.0 5.0 -moz- |
4.0 -webkit- | 15.0 -webkit- 12.1 12.0 -o- |
实例
背景颜色逐渐地从红色变化到蓝色:
@keyframes mymove
{
from {background-color:red;}
to {background-color:blue;}
}
/*Safari 和 Chrome:*/
@-webkit-keyframes mymove
{
from {background-color:red;}
to {background-color:blue;}
}
动画属性
CSS 中的动画属性:
| 属性 | 实例 |
|---|---|
| background | |
| background-color | |
| background-position | |
| background-size | |
| border | |
| border-bottom | |
| border-bottom-color | |
| border-bottom-left-radius | |
| border-bottom-right-radius | |
| border-bottom-width | |
| border-color | |
| border-left | |
| border-left-color | |
| border-left-width | |
| border-right | |
| border-right-color | |
| border-right-width | |
| border-spacing | |
| border-top | |
| border-top-color | |
| border-top-left-radius | |
| border-top-right-radius | |
| border-top-width | |
| bottom | |
| box-shadow | |
| clip | |
| color | |
| column-count | |
| column-gap | |
| column-rule | |
| column-rule-color | |
| column-rule-width | |
| column-width | |
| columns | |
| filter | |
| flex | |
| flex-basis | |
| flex-grow | |
| flex-shrink | |
| font | |
| font-size | |
| font-size-adjust | |
| font-stretch | |
| font-weight | |
| height | |
| left | |
| letter-spacing | |
| line-height | |
| margin | |
| margin-bottom | |
| margin-left | |
| margin-right | |
| margin-top | |
| max-height | |
| max-width | |
| min-height | |
| min-width | |
| opacity | |
| order | |
| outline | |
| outline-color | |
| outline-offset | |
| outline-width | |
| padding | |
| padding-bottom | |
| padding-left | |
| padding-right | |
| padding-top | |
| perspective | |
| perspective-origin | |
| right | |
| text-decoration-color | |
| text-indent | |
| text-shadow | |
| top | |
| transform | |
| transform-origin | |
| vertical-align | |
| visibility | |
| width | |
| word-spacing | |
| z-index |
点我分享笔记