<div id="description">
<h2>Приклад 1</h2>
<p>Наведіть курсор на квадрат, щоб побачити ефект зміни кольору.</p>
</div>
<div id="result">
<div class="square"></div>
</div>
#description {
background: #eee;
padding: 20px;
font-family: Arial, sans-serif;
}
#result {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
}
.square {
width: 150px;
height: 150px;
background-color: color-mix(in srgb, #654aaa, white);
transition: background-color 0.3s ease;
}
.square:hover {
background-color: color-mix(in srgb, #654aaa 70%, white);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.