I'm trying to create a progress indicator - and to a certain extent I've done it, but it's not what I want to end up with. Here's an image:
As you can see the indicator shows 1 third, 2 thirds, then full. This is what I want to achieve except that I want the first, second and third sections to be different colors, so I would end up with 3 equal slices in 3 different colors starting at 12 o'clock.
Here's the code - I've removed the centre section because it's not relevant to the question: (the CSS is in Less syntax)
.timeline {
h3 {
position:relative;
& > .step {
background-color:@accentColor;
background-clip:padding-box;
border:solid 1px @divider;
border-radius:50%;
height:52px;
position:absolute;
top:0;
left:0;
width:52px;
&.one {
background-image: linear-gradient(210deg, transparent 50%, white 50%),
linear-gradient(90deg, white 50%, transparent 50%);
}
&.two {
background-image: linear-gradient(90deg, transparent 50%, @accentColor 50%),
linear-gradient(144deg, white 50%, transparent 50%);
}
&.three {}
}
}
}
<div class="timeline">
<h3><span class="step one"></span></h3>
<h3><span class="step two"></span></h3>
<h3><span class="step three"></span></h3>
</div>
I'm not really undersanding the interaction between the gradients, and despite several edits I'm no nearer to any kind of solution.
Is this possible using linear gradients or do I need to look again?
For Step One:
.step
element. When multiple images are added to an element, the one specified first is the topmost layer and the last one is the bottom layer.background-color
of the.step
element through (but here it does not because I've wantedly not set anybackground-color
to the.step
element).210deg
) which again is white for 50% (the lower part) and transparent for the other. The top part being transparent will show the color of the layers below it..step
element for rest.For Step Two:
background-color
for the other half (widthwise). This provides the appearance of 50% progress.For Step Three:
You actually don't need a gradient at all here. All you need is only a full solid color.
Or, you can use two gradients also to mimic the solid fill like here.
Complete Solution:
Now coming to the final bit, you need to place a smaller circle with a different color on top to make the fill look like it is only the border which is getting filled.