css - 页面上的多个 <progress> 元素具有不同的颜色

标签 css html pseudo-element

我正在使用该元素,并且我发现了关于 [样式] ( http://html5doctor.com/the-progress-element/ ) 的很好的说明。

我希望在一个页面上有多个进度条,并且我希望它们具有不同的填充/值颜色。这可能吗?我可以通过调整我的 CSS 来做到这一点吗?或者我最好自己动手?谢谢!

.current-roll {
  -webkit-appearance: none;
  width: 80%;
  height: 25px;
  /* next line does nothing */
  color: #f7a700
}
.previous-roll {
  -webkit-appearance: none;
  width: 80%;
  height: 25px;
  /* next line does nothing */
  color: #98c11e
}
progress::-webkit-progress-bar {
  background: #d8d8d8;
}
progress::-webkit-progress-value {
  background: #f7a700;
}
<p>Orange bar</p>
<progress class="current-roll" value="0.5"></progress>

<p>Green bar</p>
<progress class="previous-roll" value="0.75"></progress>

最佳答案

progress::-webkit-progress-value 是改变进度条颜色的因素。

例子

progress.current-roll::-webkit-progress-value {
  background: #f7a700;
}

关于css - 页面上的多个 <progress> 元素具有不同的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39128407/

相关文章:

css - 如何改变CSS中不相关元素的样式

html - 如何将 CSS 应用于除特定类的 li 内的输入之外的所有输入元素

css - 页脚不会延伸到溢出

html - BootStrap 3 - 带下拉菜单的导航栏,下拉菜单的扩展超出最大高度

javascript - 同步文本框(在表单中输入)

html - :before work in css?如何

android - HTML 输入类型 'file' 不适用于 android 中的 webview。有没有办法使用 webview android 上传文件?

php - 获取标记帖子 wordpress

HTML CSS,::添加后不考虑父级的溢出:隐藏

css - :not(:empty):before pseudo-classes/elements combination