Using JS here is an extreme case, since the performance and maintainability of your code will suffer from this.
The problem with this gradient that needs to be rotated is that between the repetitions of the gradient itself, spaces are needed and there is no way for CSS to add them.
Therefore, we will make a picture using SVG: a rectangle that occupies 50% of the width of the image with the gradient we need.
svg { /* бесконечная серая тень чтобы выделить саму картинку */ box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.1); }
<svg> <linearGradient id="gradient" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="0" y2="1" > <stop offset="0" style="stop-color:#d43434"/> <stop offset="1" style="stop-color:#000"/> </linearGradient> <rect width="50%" height="100%" fill="url(#gradient)" /> </svg>
Next, either save this image and use the link to it (preferably), or encrypt it (for example, using this service ) for use in CSS:
.bg { width: 200px; height: 300px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3ClinearGradient id='gradient' gradientUnits='objectBoundingBox' x1='0' y1='0' x2='0' y2='1' %3E%3Cstop offset='0' style='stop-color:%23d43434'/%3E%3Cstop offset='1' style='stop-color:%23000'/%3E%3C/linearGradient%3E%3Crect width='50%25' height='100%25' fill='url%28%23gradient%29' /%3E%3C/svg%3E") 0 0 / 40px 100% round, linear-gradient(to bottom, #04bcef 0%, #ed8200 53%, #ed8200 100%); }
<div class="bg"></div>
In the example above, this SVG is set to background-size: 40px 100% and background-repeat: repeat-x .