[英]styling issues with a progressbar chrome
I have a program in html that has a progress element. 我有一个html程序,它有一个progress元素。 It turns blue in firefox, but refuses to work in chrome, and it turns green, which I don't want. 它在firefox中变成蓝色,但拒绝在chrome中工作,它变成了绿色,这是我不想要的。 my code 我的代码
progress {
color: #0063a6;
font-size: .6em;
line-height: 1.5em;
text-indent: .5em;
width: 30em;
height: 3em;
border: 1px solid #0063a6;
background: #fff;
}
<progress value ="50" max ="100"></progress>
You need to do two things. 你需要做两件事。 First reset the style of the progressbar to it's default values and then target the appearance with a browser specific pseudo class like so: 首先将进度条的样式重置为默认值,然后使用特定于浏览器的伪类来定位外观,如下所示:
progress {
-webkit-appearance: none;
appearance: none;
}
progress::-webkit-progress-bar {
background-color: #eee;
border-radius: 2px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset;
}
styling the bar itself is done using background-image: 使用background-image完成条形本身的样式:
progress[value]::-webkit-progress-value {
background-image:
-webkit-linear-gradient(-45deg,
transparent 33%, rgba(0, 0, 0, .1) 33%,
rgba(0,0, 0, .1) 66%, transparent 66%),
-webkit-linear-gradient(top,
rgba(255, 255, 255, .25),
rgba(0, 0, 0, .25)),
-webkit-linear-gradient(left, #09c, #f44);
border-radius: 2px;
background-size: 35px 20px, 100% 100%, 100% 100%;
}
Read the full article here: https://css-tricks.com/html5-progress-element/ 阅读完整文章: https : //css-tricks.com/html5-progress-element/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.