效果图
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>过渡</title>
<style>
.box {
width: 200px;
height: 200px;
background-color: skyblue;
/* transition-property:指定要过渡的属性,例如 width 、 height 、 background-color 等,all表示两个状态属性值不同的所有属性,都产生过渡效果。
transition-duration:过渡效果的持续时间,以秒(s)或毫秒(ms)为单位。
transition-timing-function:过渡的速度曲线,例如 linear (匀速)、 ease (缓入缓出)、 ease-in (缓入)、 ease-out (缓出)、 ease-in-out (缓入缓出)等。
transition-delay:过渡效果的延迟时间,以秒(s)或毫秒(ms)为单位。
transition:复合属性 */
transition: all .5s linear 1s;
/* 注:transition是设置给元素本身 */
}
.box:hover {
width: 400px;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>