Firefox:进度条值的样式?

时间:2014-12-15 08:53:37

标签: html5 css3 firefox progress-bar

HTML

<progress id='video-progress' min='0' max='100' value=''></progress>

CSS

#video-progress {
    border: none;
    position:fixed;
    bottom:0;
    left:0;
    height:3px;
    width:100%;
    z-index:1;
    background: transparent !important;
}

#video-progress::-webkit-progress-bar {
    background: transparent !important;
}

#video-progress::-moz-progress-bar {
    background: transparent !important;
}

#video-progress[role][aria-valuenow] {
    background: transparent !important;
}

#video-progress::-webkit-progress-value {
    background: #fff !important;
}

#video-progress::-moz-progress-value {
    background: #fff !important;
}

#video-progress[aria-valuenow]:before {
    background: #fff !important;
}

这在Chrome中运行良好,但在Firefox中则不行。

我希望我的进度条在后台不可见/透明,只有值/进度本身为白色。

Firefox的任何想法?

1 个答案:

答案 0 :(得分:4)

这个CSS应该适用于至少Firefox和Chrome(我没有IE测试):

body {
    background: #333;
}
#video-progress {
    background: transparent;
    border: none; /* Needed for Firefox */
    color: #fff; /* For IE10 */
    -webkit-appearance: none; /* Needed for WebKit/Blink */
}
#video-progress::-moz-progress-bar { 
    background: #fff;
}
#video-progress::-webkit-progress-value {
    background: #fff;
}
#video-progress::-webkit-progress-bar {
    background: transparent;
}

请注意,我需要在进度条中放置一个值才能始终显示。这是一个似乎有用的例子: http://jsfiddle.net/jn6addvg/