1.用HTML+CSS实现圆角进度条

一、样式如下

要解决的问题就是下面那种情况,进度条在刚开始的时候由于width太小出现的问题。

 

二、代码如下

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            position: relative;
            width: 604px;
            height: 64px;
            margin: 30px auto;
        }

        .box1 {
            position: absolute;
            left: 2px;
            top: 2px;
            width: 600px;
            height: 60px;
            border: 2px solid red;
            border-radius: 30px;
            z-index: 3;
        }

        .box2 {
            position: absolute;
            left: 2px;
            top: 2px;
            width: 604px;
            height: 64px;
            background-color: red;
            /* border: 2px dashed red; */
            border-radius: 30px;
            z-index: 1;
        }

        .box3 {
            position: absolute;
            left: 2px;
            top: 2px;
            width: 604px;
            height: 64px;
            border-radius: 30px;
            background: #fff;
            /* border: 2px dashed white; */
            z-index: 2;
            transition: left 2s ease 0s;
        }

        .box:hover .box3 {
            left: 102%;
        }
    </style>
    <title>transition练习-过渡条</title>
</head>

<body>
    <div class="box">
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
    </div>
</body>

</html>

三、小结

如果有朋友可以用3个盒子或者更少的盒子实现上面的效果请私信我,我这里用到了4个盒子,一个大盒子3个小盒子。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值