过渡属性transition
transition:要过渡的属性 花费时间单位秒 运动曲线默认ease 何时开始;
后面两个可以省略;谁需要过渡就给谁添加过渡,而不是在hover和动画中,
可以写多个属性,写的同时可以用逗号分割,也可直接用all
.box1 {
width: 200px;
height: 100px;
background-color: skyblue;
/* transition: height 1s, width 1s; */
transition: all 1s;
}
实例
.bar-in {
width: 50%;
height: 100%;
border-radius: 3px;
background-color: red;
transition: all 0.5s;
}
.bar-in:hover {
width: 100%;
}