我想知道为什么div栏从左到中都没有显示绿色背景颜色。它只显示整个div吧。可能是什么问题呢?谢谢..
.BioUploadProgressBar p {
display: block;
width: 350px;
padding: 2px 5px;
margin: 12px 0;
border: 1px inset #446;
border-radius: 5px;
}
.BioUploadProgressBar p.initialize {
/*background: #0c0 none 0 0 no-repeat;*/
background-color: #0c0;
background-image: none;
background-position: 50% 0px;
background-repeat: no-repeat;
}

<div>
<div class='BioUploadProgressBar'>
<p class="initialize">Upload file 0 %</p>
</div>
</div>
&#13;
答案 0 :(得分:3)
背景 - 位置仅适用于背景图像。您将拥有以下选项:
答案 1 :(得分:1)
尝试使用:
.progress {
height: 20px;
overflow: hidden;
background-color: #F5F5F5;
border-radius: 4px;
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1) inset;
}
.cpu {
color: #FFF;
text-align: center;
transition: width 2.0s ease 0s;
background-color: #FF6633;
}
<div class="progress" style="width:500px;">
<div id="cpu" class="cpu" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 10%">
<span>10</span>
</div>
</div>
答案 2 :(得分:0)
因为你的HTML不正确而你的CSS更不正确,你使用适用于背景图片的背景属性,而不是颜色,将HTML更改为:
<div>
<div class='BioUploadProgressBar'>
<div class="initialize">Upload file 0 %</div>
</div>
</div>
和你的CSS:
.BioUploadProgressBar {
display: block;
width: 350px;
margin: 12px 0;
border: 1px solid #446;
border-radius: 5px;
}
.initialize {
border-radius: 5px;
display:inline-block;
background: #0c0;
width:175px;
;
padding:5px;
}
答案 3 :(得分:0)
.partialGradiend{
background: -moz-linear-gradient(left, rgba(0,204,0,1) 0%, rgba(0,204,0,1) 50%, rgba(0,204,0,0) 51%, rgba(0,204,0,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(0,204,0,1)), color-stop(50%,rgba(0,204,0,1)), color-stop(51%,rgba(0,204,0,0)), color-stop(100%,rgba(0,204,0,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(0,204,0,1) 0%,rgba(0,204,0,1) 50%,rgba(0,204,0,0) 51%,rgba(0,204,0,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(0,204,0,1) 0%,rgba(0,204,0,1) 50%,rgba(0,204,0,0) 51%,rgba(0,204,0,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(0,204,0,1) 0%,rgba(0,204,0,1) 50%,rgba(0,204,0,0) 51%,rgba(0,204,0,0) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(0,204,0,1) 0%,rgba(0,204,0,1) 50%,rgba(0,204,0,0) 51%,rgba(0,204,0,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00cc00', endColorstr='#0000cc00',GradientType=1 ); /* IE6-9 */
width:300px;
border: 1px inset #446;
border-radius: 5px;
text-align:center;
padding:10px 0px;
}
&#13;
<div class="partialGradiend" style="">
50%
</div>
&#13;