css的transition过渡效果
<!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> .box { width: 200px; height: 200px; background-color: pink; border-radius: 15px; margin: 0 auto; /* 谁做过渡给谁加,transition: 要过渡的属性 花费时间 运动曲线(可省略) 何时开始(可省略) */ transition: all 1.5s; } .box:hover { width: 400px; height: 400px; box-shadow: 10px 10px 10px -4px rgba(0, 0, 0, 0.5); } </style> </head> <body> <div class="box"> </div> </body> </html>