- transition從一個屬性值變化到另外一個屬性值的一個動畫效果
- animation產(chǎn)生更加復(fù)雜的動畫
transition: <過度屬性名稱> 過度時間 <過渡模式>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鳥教程(runoob.com)</title>
<style>
div
{
width:100px;
height:100px;
background:red;
transition:width 2s;
}
div:hover
{
width:300px;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
transform-style: preserve-3d 展示為3D
CSS3產(chǎn)生3D場景
perspective: 物理離窗口距離
perspective-origin: 人的觀察點(diǎn)
translate: 位移
rotate: 旋轉(zhuǎn)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鳥教程(runoob.com)</title>
<style>
div#div1
{
perspective:800;
perspective-origin: 50% 50%;
transform-style: preserve-3d;
}
div#div2
{
width:500px;
height:500px;
background-color:red;
border:1px solid black;
transform:rotateY(45deg);
-webkit-transform:rotateY(45deg); /* Safari and Chrome */
}
</style>
</head>
<body>
<div id="div1">
<div id="div2"></div>
</div>
</body>
</html>