简体   繁体   English

显示进度条值

[英]Showing Progress Bar Values

I've been trying to make a progress bar with a value in the middle with just html and css but I have no idea how to go about it.我一直在尝试只用 html 和 css 制作一个中间有一个值的进度条,但我不知道该怎么做。 I need some help with integrating the given value into the bar so it shows the value in the middle.我需要一些帮助将给定值集成到条形图中,以便它在中间显示值。

My code so far is this:到目前为止,我的代码是这样的:

 <progress id="file" value="80" max="100"> 80% </progress>

but it doesn't show number in the middle.但它没有在中间显示数字。

You can check W3Schools Custom Progress Bar .您可以查看W3Schools 自定义进度条

  1. Create an outer div as a container of the progress bar创建一个外部div作为进度条的容器
  2. An inner div div that shows the "progress"显示“进度”的内部 div div
  3. Change the "progress" using javascript使用 javascript 更改“进度”

You can try this:你可以试试这个:

 <div style="background-color: grey; text-align:center"> <div style="width:25%;background-color:green;">25%</div> </div>

You can add more CSS on outer and inner div to make it more appealing您可以在外部和内部div上添加更多 CSS 以使其更具吸引力

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM