使用过度属性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>

 

posted on 2023-07-25 00:36  码农-编程小子  阅读(25)  评论(0编辑  收藏  举报