I am creating a progress bar and my issue is: When the % progress is low (width: 0-5%), the border radius does not look the same as when it is larger (width: 5-100%).
In example 1 below, you can see the progress bar as it is intended to look.
In example 2 & 3, you can see how it looks when the width is low, causing the border-radius of the progress bar to not function the same as example 1.
I am considering I need a different way to "cut off" the progress, rather than just decreasing the width, but I wasn't able to come up with anything simple to do so. Anyone have a good idea on how to improve this code?
Note: I also have a secondary "ghost" progress bar which experiences the same issue and has complicated my attempts to keep it simple.
I have looked up some progress bar examples, but they experience the same issue. Some of the ones I have seen avoid the problem entirely by skipping straight from 0 to 5% but I do not want to do that.
.progress-bar {
position: absolute;
width: 0px;
height: 17px;
border: 0px solid white;
/* border-radius issue */
border-radius: 8px;
}
.progress-bar-container {
position: relative;
width: 200px;
}
/* some helper classes */
.ghost {
opacity: 0.15;
}
.progress-percent {
margin-bottom: 4px;
}
.bg-blue {
background: #0096FF;
}
.bg-grey {
background: #E8E8E8;
}
.outer-container {
margin-top: 16px
}
<!-- example 1 -->
<div class="outer-container">
<div class="progress-bar progress-bar-container bg-grey">
<div class="progress-bar ghost bg-blue" style="width: 75%;">
</div>
<!-- variable width is above ~5% -->
<div class="progress-bar bg-blue" style="width: 45%">
</div>
</div>
</div>
<!-- example 2 -->
<div class="outer-container">
<div class="progress-bar progress-bar-container bg-grey">
<div class="progress-bar ghost bg-blue" style="width: 45%">
</div>
<!-- variable width is below ~5% -->
<div class="progress-bar bg-blue" style="width: 1%">
</div>
</div>
</div>
<!-- example 3 -->
<div class="outer-container">
<div class="progress-bar progress-bar-container bg-grey">
<div class="progress-bar ghost bg-blue" style="width: 45%">
</div>
<!-- variable width is below ~5% -->
<div class="progress-bar bg-blue" style="width: 3%">
</div>
</div>
</div>
Here is the JSFiddle with some extra hover text which is un-related to issue.

