I am relatively new to programming (starting learning web dev less than 3 months ago), however already attempting to create a pretty complex (at least to me) progress bar.
I need this progress bar to not only change colors while the bar automatically moves from left to right as soon as the page loads - I've seen explanations all over the internet on how to do those.
However, once it is done, I need the colors for each portion (say, each 10%) to remain the same. So for example if the first 10% are a light red, the next 10% a darker red, etc... it first automatically goes through them as it animates, but then remains static with the different colors still seen and not just one last solid color.
The only way that I have found to do this so far is to create many different bars, each having a different z-index, however I am well aware this is very convoluted and probably not the most efficient way to implement this.
Like I said I am new to this so please be gentle :) I will show my code beneath. If anyone has a better suggestion, how I can have the different color separations within the same bar I would love to learn something new!
Thanks!
HTML:
<div class="meter">
<span id="rd1" style="width: 5%"><p></p></span>
<span id="rd2" style="width: 10%"><p></p></span>
<span id="rd3" style="width: 15%"><p></p></span>
<span id="rd4" style="width: 20%"><p></p></span>
<span id="rd5" style="width: 25%"><p></p></span>
<span id="rd6" style="width: 30%"><p></p></span>
<span id="rd7" style="width: 35%"><p></p></span>
<span id="rd8" style="width: 40%"><p></p></span>
<span id="rd9" style="width: 45%"><p></p></span>
<span id="rd10" style="width: 50%"><p></p></span>
<span id="rd11" style="width: 55%"><p></p></span>
<span id="rd12" style="width: 60%"><p></p></span>
<span id="rd13" style="width: 65%"><p></p></span>
<span id="rd14" style="width: 70%"><p></p></span>
<span id="rd15" style="width: 75%"><p></p></span>
<span id="rd16" style="width: 80%"><p></p></span>
<span id="rd17" style="width: 85%"><p></p></span>
<span id="rd18" style="width: 90%"><p></p></span>
<span id="rd19" style="width: 95%"><p></p></span>
<span id="rd20" style="width: 100%"><p></p></span>
</div>
CSS:
`#keyframes color{
0% {
background-color: hsl(315, 100%, 75%);
width: 5%;
}
5% {
background-color: hsl(315, 100%, 70%);
width: 10%;
}
10% {
background-color: hsl(315, 100%, 65%);
width:15%;
}
15% {
background-color: hsl(315, 100%, 60%);
width: 20%;
}
20% {
background-color: hsl(315, 100%, 55%);
width: 25%;
}
25% {
background-color: hsl(315, 100%, 50%);
width: 30%;
}
30% {
background-color: hsl(320, 100%, 50%);
width:35%;
}
35% {
background-color: hsl(325, 100%, 50%);
width: 40%;
}
40% {
background-color: hsl(330, 100%, 50%);
width: 45%;
}
45% {
background-color: hsl(335, 100%, 50%);
width: 50%;
}
50% {
background-color: hsl(340, 100%, 50%);
width:55%;
}
55% {
background-color: hsl(345, 100%, 50%);
width: 60%;
}
60% {
background-color: hsl(350, 100%, 50%);
width: 65%;
}
65% {
background-color: hsl(355, 100%, 50%);
width: 70%;
}
70% {
background-color: hsl(360, 100%, 50%);
width:75%;
}
75% {
background-color: hsl(360, 95%, 50%);
width: 80%;
}
80% {
background-color: hsl(360, 90%, 50%);
width: 85%;
}
85% {
background-color: hsl(360, 85%, 50%);
width: 90%;
}
90% {
background-color: hsl(360, 80%, 50%);
width:95%;
}
95% {
background-color: hsl(360, 75%, 50%);
width: 100%;
}
}
.meter {
height: 20px;
position: relative;
top: 100px;
background: grey;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
border-radius: 25px;
padding: 10px;
box-shadow: inset 0 -1px 1px rgba(255,255,255,0.3);
}
#rd1 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(315, 100%, 75%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 4px;
overflow: hidden;
z-index: 20;
animation: color 4s linear 0s alternate;
}
#rd2 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(315, 100%, 70%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 32px;
overflow: hidden;
z-index: 19;
animation: color 4s linear 0s alternate;
}
#rd3 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(315, 100%, 65%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 60px;
overflow: hidden;
z-index: 18;
animation: color 4s linear 0s alternate;
}
#rd4 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(315, 100%, 60%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 88px;
overflow: hidden;
z-index: 17;
animation: color 4s linear 0s alternate;
}
#rd5 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(315, 100%, 55%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 116px;
overflow: hidden;
z-index: 16;
animation: color 4s linear 0s alternate;
}
#rd6 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(315, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 144px;
overflow: hidden;
z-index: 15;
animation: color 4s linear 0s alternate;
}
#rd7 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(320, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 172px;
overflow: hidden;
z-index: 14;
animation: color 4s linear 0s alternate;
}
#rd8 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(325, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 200px;
overflow: hidden;
z-index: 13;
animation: color 4s linear 0s alternate;
}
#rd9 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(330, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 228px;
overflow: hidden;
z-index: 12;
animation: color 4s linear 0s alternate;
}
#rd10 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(335, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 256px;
overflow: hidden;
z-index: 11;
animation: color 4s linear 0s alternate;
}
#rd11 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(340, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 284px;
overflow: hidden;
z-index: 10;
animation: color 4s linear 0s alternate;
}
#rd12 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(345, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 312px;
overflow: hidden;
z-index: 9;
animation: color 4s linear 0s alternate;
}
#rd13 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(350, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 340px;
overflow: hidden;
z-index: 8;
animation: color 4s linear 0s alternate;
}
#rd14 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(355, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 368px;
overflow: hidden;
z-index: 7;
animation: color 4s linear 0s alternate;
}
#rd15 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(360, 100%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 396px;
overflow: hidden;
z-index: 6;
animation: color 4s linear 0s alternate;
}
#rd16 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(360, 95%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 424px;
overflow: hidden;
z-index: 5;
animation: color 4s linear 0s alternate;
}
#rd17 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(360, 90%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 452px;
overflow: hidden;
z-index: 4;
animation: color 4s linear 0s alternate;
}
#rd18 {
display: block;
height: 140%;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(360, 85%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 480px;
overflow: hidden;
z-index: 3;
animation: color 4s linear 0s alternate;
}
#rd19 {
display: block;
height: 140%;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(360, 80%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 508px;
overflow: hidden;
z-index: 2;
animation: color 4s linear 0s alternate;
}
#rd20 {
display: block;
height: 140%;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-color: hsl(360, 75%, 50%);
background-image: linear-gradient(
center bottom,
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 0px 0px rgba(255,255,255,0.1),
inset 0 -6px 6px rgba(0,0,0,0.4);
position: relative;
bottom: 536px;
overflow: hidden;
z-index: 1;
animation: color 4s linear 0s alternate;
}
#-webkit-keyframes move {
0% {background-position: 0px 0px, 0 0, 0 0}
100% {background-position: -100px 0px, 0 0, 0 0}
}
I have a figure with bevel corners, but the background is not rounded:
How to have it rounded?
.test-block {
height: 480px;
padding: 4px;
color: #ffffff;
background-color: transparent;
background-image:
-webkit-linear-gradient(top, #ffdc00, #ffdc00),
-webkit-linear-gradient(225deg, #ffdc00, #ffdc00),
-webkit-linear-gradient(bottom, #ffdc00, #ffdc00),
-webkit-linear-gradient(left, #ffdc00, #ffdc00),
-webkit-linear-gradient(315deg, transparent 9px, #ffdc00 10px, #ffdc00 12px, red 12px);
background-image:
linear-gradient(180deg, #1698d9, #1698d9),
linear-gradient(225deg, #1698d9, #1698d9),
linear-gradient(0deg, #1698d9, #1698d9),
linear-gradient(90deg, #1698d9, #1698d9),
linear-gradient(135deg, transparent 28px, #1698d9 28px, #1698d9 32px, #ffffff 10px);
background-position: top right, top right, bottom left, bottom left, top left;
background-size: -webkit-calc(100% - 15px) 2px, 2px 100%, 100% 2px, 2px -webkit-calc(100% - 15px), 100% 100%;
background-size: calc(100% - 40px) 4px, 4px 100%, 100% 4px, 4px calc(100% - 40px), 100% 100%;
background-repeat: no-repeat;
border-radius: 10px;
width: 320px;
}
.test-block__div {
background-image: url(http://css-snippets.com/blogfile/wp-content/uploads/2011/03/square.jpg);
background-repeat: no-repeat;
background-position: -24px 208px;
height: 100%;
}
<div class="test-block">
<div class="test-block__div"></div>
</div>
Since you are using multiple background you can add more using radial-gradiant to create the corner (I removed the vendor prefixes to simplify the code)
.test-block {
height: 480px;
padding: 4px;
color: #ffffff;
background-color: transparent;
background-image:
radial-gradient(circle at top left, transparent 40%, #1698d9 0%),
radial-gradient(circle at bottom left, transparent 40%, #1698d9 0%),
radial-gradient(circle at top right, transparent 40%, #1698d9 0%),
linear-gradient(180deg, #1698d9, #1698d9),
linear-gradient(225deg, #1698d9, #1698d9),
linear-gradient(0deg, #1698d9, #1698d9),
linear-gradient(90deg, #1698d9, #1698d9),
linear-gradient(135deg, transparent 28px, #1698d9 28px, #1698d9 32px, transparent 10px);
background-position:
bottom right,
top right,
bottom left,
top right,
top right,
bottom left,
bottom left,
top left;
background-size:
10px 10px, 10px 10px, 10px 10px,
calc(100% - 40px) 4px,
4px 100%,
100% 4px,
4px calc(100% - 40px),
100% 100%;
background-repeat: no-repeat;
border-radius: 10px;
width: 320px;
}
body {
background-image:linear-gradient(30deg, pink, yellow);
}
<div class="test-block">
</div>
By the way you can achieve the same layout using pseudo-element and without multiples background. It can be easier to handle:
.test-block {
height: 440px;
padding: 4px;
margin-top: 60px;
color: #ffffff;
border-right: 4px solid #1698d9;
border-left: 4px solid #1698d9;
border-bottom: 4px solid #1698d9;
border-radius: 0 0 10px 10px;
width: 320px;
position: relative;
}
.test-block:before {
content: "";
position: absolute;
left: -4px;
width: 50%;
height: 40px;
top: -44px;
border-left: 4px solid #1698d9;
border-top: 4px solid #1698d9;
transform: skewX(-40deg);
transform-origin: bottom left;
}
.test-block:after {
content: "";
position: absolute;
right: -4px;
height: 40px;
width: 50%;
top: -44px;
border-right: 4px solid #1698d9;
border-top: 4px solid #1698d9;
border-radius: 0 10px 0 0;
}
body {
background-image: linear-gradient(30deg, pink, yellow);
}
<div class="test-block">
</div>
I want to customize a slider like this:
So I was wondering if there was an easy CSS way of doing that, which would adapt to the width of the parent element. Or if I need to add circles in my html and set the color given the percentage.
Here are my two problems that I don't know how to do in full CSS:
Make circles repeat in the background
color only circles using some kind of overlay div that would have background: #color
Is any of that possible?
Thanks!
I don't want to use anything with javascript though, my webpages are heavy enough as is :p
You can use a repeated radial gradient to create dots like this:
Create a single circle with a radial gradient:
radial-gradient(ellipse at center, #ffbdd7 0%, #ffbdd7 30%, transparent 30%)
Place the gradient into a background which is repeated on the x-axis with background-repeat: repeat-x
Center the background horizontally with background-position
Control the size of the circles with background-size
Example
body {
margin: 0;
}
div {
background: radial-gradient(ellipse at center, #ffbdd7 0%, #ffbdd7 30%, transparent 30%);
background-size: 20px 20px;
background-repeat: repeat-x;
background-position: 5px center;
width: 100vw;
height: 50px;
}
<div></div>
Create a custom range slider input
You can use <input type="range"> and customise it. It's a little bit messy to work cross-browser.
Example
body {
margin: 0;
}
input[type=range] {
-webkit-appearance: none;
cursor: pointer;
background: radial-gradient(ellipse at center, #ffbdd7 0%, #ffbdd7 30%, transparent 30%, transparent 100%) 5px center repeat-x;
background-size: 20px 20px;
width: 100vw;
height: 50px;
outline: 0;
margin: 0;
box-sizing: border-box;
}
/*Chrome*/
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
height: 27px;
width: 15px;
background: linear-gradient(to right, #ffffff 0%, #ffffff 39%, #ffbdd7 39%, #ffbdd7 61%, #ffffff 61%, #ffffff 100%) 0 no-repeat;
border-radius: 4px;
background-size: 100% 17px;
box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.1), 0 0 10px rgba(0, 0, 0, 0.5);
transition: box-shadow .3s;
}
input[type=range]:focus::-webkit-slider-thumb {
box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 0, 0, 0.5)
}
/*Firefox*/
input[type=range]::-moz-range-thumb {
height: 27px;
width: 15px;
background: linear-gradient(to right, #ffffff 0%, #ffffff 39%, #ffbdd7 39%, #ffbdd7 61%, #ffffff 61%, #ffffff 100%) 0 no-repeat;
border-radius: 4px;
background-size: 100% 17px;
border: none;
box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.5);
}
input[type=range]::-moz-range-track {
background: none;
}
/*IE 11 and Edge*/
input[type=range]::-ms-track {
color: transparent;
background: none;
border: none;
}
input[type=range]::-ms-thumb {
height: 27px;
width: 15px;
background: linear-gradient(to right, #ffffff 0%, #ffffff 39%, #ffbdd7 39%, #ffbdd7 61%, #ffffff 61%, #ffffff 100%) 0 no-repeat;
border-radius: 4px;
background-size: 100% 17px;
border: none;
margin-top: 3px;
box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.5);
}
input[type=range]::-ms-fill-lower {
background: none;
}
input[type=range]::-ms-fill-upper {
background: none;
}
<input type="range">
A useful blog article on cross-browser range input styling can be found over here.
You could fudge it with a full-stop repeated within a CSS content attribute on the :before and :after selectors.
Crude example:
https://jsfiddle.net/xkueyxvb/
I have a div with 100% width on my page.
Now I need to show blocks into a <div> just like windows progressbar can anyone tell how I can create those blocks in the my div?
Looks like this:
I copied #Anshuman Dwibhashi answer, but I changed the background to a piece of the image you posted. Now you just increase or decrease the percentage width of .sub-block to change the load bar progress.
<div class="main" style="border:solid;background-color:white;width:500px;height:25px;">
<div class="sub-block" style="background:url('http://i.imgur.com/PRBmb4s.png');width:30%;height:25px;" ></div>
</div>
Like this
DEMO
CSS
.progress-striped .bar {
background-color: #149BDF;
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-size: 40px 40px;
}
.progress .bar {
-moz-box-sizing: border-box;
background-color: #0E90D2;
background-image: linear-gradient(to bottom, #149BDF, #0480BE);
background-repeat: repeat-x;
box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.15) inset;
color: #FFFFFF;
float: left;
font-size: 12px;
height: 100%;
text-align: center;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
transition: width 0.6s ease 0s;
width: 0;
}
.progress {
background-color: #F7F7F7;
background-image: linear-gradient(to bottom, #F5F5F5, #F9F9F9);
background-repeat: repeat-x;
border-radius: 4px 4px 4px 4px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
height: 20px;
margin-bottom: 20px;
overflow: hidden;
}
.progress-striped .bar {
background-color: #149BDF;
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-size: 40px 40px;
}
.progress-success.progress-striped .bar, .progress-striped .bar-success {
background-color: #62C462;
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
Try this:
DEMO
CSS
.main {
border: solid;
background-color: white;
width: 500px;
height: 25px;
}
.sub-block {
background-color: green;
display:inline-block;
width: 20px;
height: 25px;
}
HTML
<div class="main" >
<div class="sub-block" ></div>
</div>
add more number of sub-blocks according to your need;
Create an image file of that Block and use it as a background for the progress inner element. Give the background repeat-x.
For instance:
background: url("Block.png") left top repeat-x transparent;
For further reading:
http://css-tricks.com/css3-progress-bars/
Progress Bar with HTML and CSS
Creating & Styling Progress Bar With HTML5
In your HTML
<div class="block-container">
<div class="sub-block" ></div>
<div class="sub-block" ></div>
<div class="sub-block" ></div>
.
.
.
</div>
In your css file
.block-container
{
background-color:white;
width: 500px;
height: 25px;
}
.sub-block {
background-color: green;
width: 20px;
height: 25px;
padding-left: 3px;
}
OR
<div class='fix size'>
<div style="width:100%;">
<div>
10 sub-div 10% each
</div>
</div>
</div>