代码如下所示:
#progressBox{
width: 300px;
height: 40px;
position: relative;
border: 1px solid #c8c8c8;
background: #fff;
}
#progressBar,#progressText{
position: absolute;
left: 0;
top: 0;
width: 100%;
line-height: 40px;
font-size: 18px;
text-align: center;
}
/*clip属性适使用于绝对定位*/
#progressBar{
z-index: 2;
background: #00a1f5;
/*第二个参数表示所切宽度*/
clip: rect(0px,0px,140px,0px);
color: white;
}
#progressText{
z-index: 1;
color: black;
}