单属性过渡
鼠标悬停在盒子上时,盒子变大2倍
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
margin: 100px auto;
width: 200px;
height: 200px;
background-color: orange;
transition: transform 1s ease 0s;
}
div:hover {
transform: scale(2);
}
</style>
</head>
<body>
<div></div>
</body>
</html>
多属性过渡
鼠标悬停在盒子上时,盒子变大2倍,旋转45度,颜色变为绿色
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
margin: 100px auto;
width: 200px;
height: 200px;
background-color: orange;
transition: all 1s ease 0s;
}
div:hover {
transform: scale(2) rotate(45deg);
background-color: green;
}
</style>
</head>
<body>
<div></div>
</body>
</html>