<section>
  <label for="angle">Angle:</label>
  <input type="range" min="-360" max="360" value="90" step="1" id="angle" name="angle" />
  <output id="output">90deg</output>
</section>
<div data-gradient-type="linear-gradient()"></div>
<div data-gradient-type="linear-gradient()"></div>
<div data-gradient-type="linear-gradient()"></div>
<div data-gradient-type="repeating-linear-gradient()"></div>

<div data-gradient-type="linear-gradient()"></div>
<div data-gradient-type="linear-gradient()"></div>
<div data-gradient-type="linear-gradient()"></div>
<div data-gradient-type="repeating-linear-gradient()"></div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  min-height: 100vh;
  font-family: "Exo", Arial, sans-serif;
  background-color: #222;
  color: #fff;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 36px 10px;
  padding: 10px 10px 36px;
  font-size: 1.5rem;
}

section {
  grid-column: span 4;
  display: flex;
  justify-content: center;
  align-items: center;
}

:root {
  --angle: 90deg;
}

div {
  min-height: 30vh;
  border-radius: 5px;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
  position: relative;
}

div:nth-of-type(1) {
  background-image: linear-gradient(var(--angle), red, gold);
}

div:nth-of-type(2) {
  background-image: linear-gradient(var(--angle), red, gold);
  background-size: 40px;
  background-repeat: no-repeat;
}

div:nth-of-type(3) {
  background-image: linear-gradient(var(--angle), red, gold);
  background-size: 40px;
}

div:nth-of-type(4) {
  background-image: repeating-linear-gradient(
    var(--angle),
    red,
    red 0,
    gold 40px,
    gold 40px
  );
}

div:nth-of-type(5) {
  background-image: linear-gradient(
    var(--angle),
    red,
    red 50%,
    gold 50%,
    gold 100%
  );
}

div:nth-of-type(6) {
  background-image: linear-gradient(
    var(--angle),
    red,
    red 50%,
    gold 50%,
    gold 100%
  );
  background-size: 40px;
  background-repeat: no-repeat;
}

div:nth-of-type(7) {
  background-image: linear-gradient(
    var(--angle),
    red,
    red 50%,
    gold 50%,
    gold 100%
  );
  background-size: 40px;
  background-repeat: repeat-x;
}

div:nth-of-type(8) {
  background-image: repeating-linear-gradient(
    var(--angle),
    red,
    red 20px,
    gold 20px,
    gold 40px
  );
}

div::after {
  content: attr(data-gradient-type);
  position: absolute;
  left: 5px;
  right: 5px;
  top: calc(100% + 5px);
  text-align: center;
  font-size: 12px;
}
const rootElement = document.documentElement;
const angleInput = document.getElementById("angle");
const outputAngle = document.getElementById("output");

angleInput.addEventListener("input", (evt) => {
  const targetVal = evt.target.value;
  rootElement.style.setProperty("--angle", `${targetVal}deg`);
  outputAngle.textContent = `${targetVal}deg`;
});
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.