<div id="description">
  <h2>Приклад 1</h2>
  <p>Наведіть курсор на квадрат, щоб побачити зміну градієнта.</p>
</div>
<div id="result">
  <div class="box"></div>
</div>
#description {
  font-style: italic;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 50px;
  padding: 12px 16px;
  background-color: #f7f7f7;
  border: 1px solid #ccc;
}

#result {
  display: flex;
  justify-content: center;
}

.box {
  width: 200px;
  height: 200px;
  background: repeating-linear-gradient(0deg, blue, green 40%, red);
  transition: background 0.3s ease;
}

.box:hover {
  background: repeating-linear-gradient(90deg, green, red 15%, yellow);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.