進度條編寫

 

<style>
.mui-progressbar {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    height: 2px;
    -webkit-transform-origin: center top;
    transform-origin: center top;
    vertical-align: middle;
    border-radius: 2px;
    background: #b6b6b6;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    }
    
    .mui-progressbar span {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-transition: 150ms;
    transition: 150ms;
    -webkit-transform: translate3d(-100%,0,0);
    transform: translate3d(-100%,0,0);
    background: #007aff;
}
    
</style>

<p class="mui-progressbar mui-progressbar-in" data-progress="20"><span style="transform: translate3d(-70%, 0px, 0px);"></span></p>

注意:控制紅色的部分 -70% 比例就好,使用100-20=70,加上負號和百分比就OK
相關文章
相關標籤/搜索