【发布时间】:2016-03-22 16:44:03
【问题描述】:
我想通过添加小黑点来设置 HTML5 进度条当前进度的“结尾”,请看屏幕。所以这个点必须随着进度的移动而移动
但是the code I found 这里不再起作用了。几周前它工作了,但现在不行了 - see the codepen
也许有人知道发生了什么或如何实现我的目标?
非常感谢!
附:这是我使用的 HTML/CSS
HTML:
<progress value="1400" max="4261"></progress>
CSS
progress {
/* Positioning */
position: absolute;
left: 0;
top: 0;
/* Dimensions */
width: 100%;
height: 50px;
/* Reset the appearance */
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
/* Get rid of the default border in Firefox/Opera. */
border: none;
/* Progress bar container for Firefox/IE10+ */
background-color: transparent;
/* Progress bar value for IE10+ */
color: #00D38D;
}
progress[value]::-webkit-progress-value {
position: relative;
background: #00d38d;
}
progress[value]::-webkit-progress-value::after {
content: '';
width: 20px;
height: 20px;
position: absolute;
right: 10px;
top: 15px;
border-radius: 50px;
background: black;
}
progress::-webkit-progress-bar {
background-color: transparent;
}
progress::-webkit-progress-value {
background-color: #00D38D;
}
progress::-moz-progress-bar {
background-color: #00D38D;
}
【问题讨论】:
-
你可能不得不使用 JS
-
是的,我当然可以用 JS,但我想用 CSS 来做,特别是因为它以前工作过,然后就停止了
-
如果它的浏览器支持太差以至于即使是最新的浏览器也有粗略的覆盖范围,你可能不应该使用它。
标签: html css progress-bar