1. html 结构
<!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>transition</title>
</head>
<body>
<div class="box"></div>
</body>
</html>
2. css 样式
body {
background-color: #333;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.box {
background-color: white;
width: 100px;
height: 100px;
/* transition-property: background; */
/* transition-duration: 2s; */
/* 延迟 */
/* transition-delay: 2s; */
/* transition-timing-function: ease-in-out; */
transition: 2s ease-in-out;
}
.box:hover {
background-color: red;
border-radius: 50%;
width: 300px;
height: 300px;
}
3. 动画属性
transition: 2s ease-in-out;