大家好 !
我想在 CSS 中创建一个小的圆形静态流量指示器,但我找不到解决方案。左边的平方指标没问题,但是太丑了,我想要它圆形!
我尝试过圆角(cf 屏幕截图右侧的指示器),我想知道是否有可能添加圆角遮罩来隐藏角落(参见 css3 遮罩:http ://webkit.org/blog/181 /css-masks/),但它似乎只适用于img ...
该解决方案仅适用于 webkit 浏览器,因为它适用于移动 webapp。
这是我在上图中创建(丑陋)指标的代码:
<div class="meter-wrap">
<div class="meter-value" style="background-color: #489d41; width: 70%;">
<div class="meter-text"> 70 % </div>
</div>
</div>
和CSS:
.meter-wrap{
position: relative;
}
.meter-value {
background-color: #489d41;
}
.meter-wrap, .meter-value, .meter-text {
width: 30px; height: 30px;
/* Attempt to round the corner : (indicators at the right of the screenshot)
-webkit-border-radius : 15px;*/
}
.meter-wrap, .meter-value {
background: #bdbdbd top left no-repeat;
}
.meter-text {
position: absolute;
top:0; left:0;
padding-top: 2px;
color: #000;
text-align: center;
width: 100%;
font-size: 40%;
text-shadow: #fffeff 1px 1px 0;
}