简体   繁体   English

HTML / Javascript进度栏

[英]HTML/Javascript Progress Bar

I am currently working with a progress bar in javascript and I am trying to display the percent inside the progress bar. 我目前正在使用javascript中的进度条,并且尝试在进度条中显示百分比。

I keep getting examples that do it with creating a div inside another div when searching but I was wondering if it is possible with an actual progress bar. 我一直在搜索时在另一个div内创建一个div的例子,但是我想知道是否可以使用实际的进度条。 Here's a fiddle example: http://jsfiddle.net/yjyrkLtm/1/ 这是一个小提琴示例: http : //jsfiddle.net/yjyrkLtm/1/

   <progress class="progress-1" id="health" value="3" max="5">test</progress>    

Any help is appreciated. 任何帮助表示赞赏。 Thanks 谢谢

Just add this: 只需添加:

progress[value]::-webkit-progress-value::before {
  content: '80%';
  position: absolute;
  right: 0;
}

Fiddle http://jsfiddle.net/yjyrkLtm/4/ 小提琴http://jsfiddle.net/yjyrkLtm/4/

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

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