Is there a way to create a gradient that displays a red line every x% without the colors fading into white?
As I add more lines, the red stripes seem to lose their intensity and blend into a white background. The .four-stripes
selector creates a good result, but once I introduce another red line like in the .more-stripes
, everything becomes blurry.
Check out an example on CodePen:
div {
width: 1200px;
height: 20px;
}
.four-stripes {
background: linear-gradient(90deg,red 0.00% 0.27%,transparent 0.27% 1.92%,red 1.92% 2.19%,transparent 2.19% 3.84%,red 3.84% 4.11%,transparent 4.11% 5.75%,red 5.75% 6.03%,transparent 6.03% 100%);
}
.more-stripes {
background: linear-gradient(90deg,red 0.00% 0.27%,transparent 0.27% 1.92%,red 1.92% 2.19%,transparent 2.19% 3.84%,red 3.84% 4.11%,transparent 4.11% 5.75%,red 5.75% 6.03%,transparent 6.03% 7.67%,red 7.67% 7.95%,transparent 7.95% 100%)
}
<div>
<div class="four-stripes"></div>
<div class="more-stripes"></div>
</div>