作者:米粒多可爱几_642 | 来源:互联网 | 2023-05-19 07:28
IhaveapercentagebarandImtryingtoputsometextoverthefrontofit.我有一个百分比栏,我试图在它的前面放一些文
I have a percentage bar and I'm trying to put some text over the front of it.
我有一个百分比栏,我试图在它的前面放一些文字。
My example does that, but it centers over the smaller bar, not the full thing.
我的例子是这样做的,但它集中在较小的条形图上,而不是完整的条形图。
My Question: How can I get the word "test" centered over the full bar, not just the inner-smaller one.
我的问题:如何让“测试”这个词集中在整个栏上,而不仅仅是内部较小的栏。
HTML
CSS
#bar1 {
background-color: black;
border-radius: 13px; /* (height of inner div) / 2 + padding */
padding: 3px;
}
#bar1 div
{
background-color: green;
height: 20px;
border-radius: 10px;
-webkit-background-size:50px 50px;
background-image:
-webkit-repeating-radial-gradient(center, circle, green, #00BB00 40%, green 80%);
-webkit-animation:upbar 3s linear infinite;
}
@-webkit-keyframes upbar
{
0%{background-position:0 0}
100%{background-position:0px -100px}
}
(apologies for the cheesiness of the bar. I'm trying to find a decent upward animation for it, so any suggestions welcome)
(为酒吧的俗气道歉。我正在努力找到一个体面的向上动画,所以欢迎任何建议)
3 个解决方案