使用 transition-delay属性设置CSS过渡效果的延迟。您可以尝试运行以下代码来设置1秒钟的转换延迟:
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 150px;
height: 150px;
background: blue;
transition: width 3s;
transition-delay: 2s;
}
div:hover {
width: 350px;
}
</style>
</head>
<body>
<h1>Heading One</h1>
<p>Hover over the below box to change its width. It begins with a delay of 2 seconds.</p>
<div></div>
</body>
</html>