请观赏
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.testDiv{
width:100px;
height: 50px;
border: 1px solid;
background-color: red;
}
.testDiv:hover{
width: 300px;
height: 150px;
background-color: blue;
/* transition-property: width,height,background-color; 过渡属性(默认值为all) */
/* transition-duration: 2s,2s,2s; 过渡持续时间(默认值为0s) */
/* transiton-timing-function: ease 过渡函数(默认值为ease函数) */
/* transition-delay: 0s 过渡延迟时间(默认值为0s) */
}
</style>
</head>
<body>
<div class="testDiv"></div>
</body>
</html>
请观赏2配合transform
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.main{
margin: auto;
margin-top: 100px;
width: 200px;
height: 200px;
background: linear-gradient(to top right,pink,green);
border-radius: 50%;
transition: transform 2s,border-radius 3s;
}
.main:hover{
transform: rotate(-80deg);
border-radius: 0;
}
</style>
</head>
<body>
<div class="main"></div>
</body>
</html>