使用过度属性transition制作进度条
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div class="progress"> <div></div> </div> </body> </html> <style> .progress { width: 300px; height: 20px; border: 1px solid red; border-radius: 10px; overflow: hidden; } .progress div { width: 50%; height: 100%; background-color: red; transition: all 1s linear; } .progress div:hover { width: 100%; } </style>
人生旅途,边走边看...