Custom Styling Progress Bar In Css
I have a progress bar and i want to style it away from default. I tried bit of things but it didn't work as I expected. I want to change the background color and border radius of t
Solution 1:
You have to work with the kit of HTML5 progress bar.These are currently the entire selectors for styling HTML5 progress bar:
progress {
/* style rules */
}
progress::-webkit-progress-bar {
/* style rules */
}
progress::-webkit-progress-value {
/* style rules */
}
progress::-moz-progress-bar {
/* style rules */
}
so :
progress {
border-radius: 7px;
width: 80%;
height: 22px;
margin-left: -11.5%;
box-shadow: 1px1px4pxrgba( 0, 0, 0, 0.2 );
}
progress::-webkit-progress-bar {
background-color: yellow;
border-radius: 7px;
}
progress::-webkit-progress-value {
background-color: blue;
border-radius: 7px;
box-shadow: 1px1px5px3pxrgba( 255, 0, 0, 0.8 );
}
progress::-moz-progress-bar {
/* style rules */
}
<progressvalue="3333"max="10000">33%</progress>
One thing to keep in mind is that there are two types of progress bars: indeterminate and determinate. If you use the above you will be changing the style for both. If you only want to change the style for a determinate bar you can do the below. This is useful if you want to style the indeterminate progress bar different, for example with a rounded spinner or anything like that.
progress {
display: block;
}
/* Determinate: */
progress[value] {
/* style rules */
}
progress[value]::-webkit-progress-bar {
/* style rules */
}
progress[value]::-webkit-progress-value {
/* style rules */
}
progress[value]::-moz-progress-bar {
/* style rules */
}
/* Indeterminate: */
progress:not([value]) {
/* style rules */
}
progress:not([value])::-webkit-progress-bar {
/* style rules */
}
progress:not([value])::-webkit-progress-value {
/* style rules */
}
progress:not([value])::-moz-progress-bar {
/* style rules */
}
<p>Determinate:</p><progressvalue="66"max="100">Determinate</progress><p>Indeterminate:</p><progress>Indeterminate</progress>
Post a Comment for "Custom Styling Progress Bar In Css"