<div class="example">
  <div class="description">
    <h2>Приклад 1</h2>
    <p>Наведенням курсору на елемент .box, його фоновий колір змінюється з червоного на синій, використовуючи функцію color().</p>
  </div>
  <div class="result">
    <div class="container">
      <div class="box"></div>
    </div>
  </div>
</div>
.example {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 50px;
}

.description {
  background-color: lightgray;
  padding: 20px;
  font-family: Arial, sans-serif;
}

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

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
}

.box {
  width: 200px;
  height: 200px;
  background-color: color(srgb 255 0 0);
  transition: background-color 0.3s ease;
}

.box:hover {
  background-color: color(srgb 0 0 255);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.