您的位置:首页 > 其它

网页进度条一种简单的实现

2017-09-22 21:23 197 查看
一个很简单的进度条

用一个简单的css属性就能实现:cilp

clip:rect(top,right,bottom,left)

先写一个小程序来解释

 <style>

        .box {

            width: 200px;

            height: 20px;

            background:#ccc;

            border-radius:10px;

            position:relative

        }

        .clip {

            position: absolute;

            width: 100%;

            height: 100%;

            clip: rect(0px,100px,20px,0px);

            background: red;

            border-radius:10px;

        }

    </style>

<div class='box'>

    <span class='clip'></span>

</div>

显示效果:



给.clip加上position:absolute;width:100%;height:100%;相对于在box里加上一个一样宽高的盒子,背景为红色;

rect(top,right,bottom,left),相对于控制这个盒子显示的面积,通过改变距离right的值,使显示的面积变大
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  网页进度条