<div id="description">
<h2>Приклад 2: елемент з плинним фоновим кольором</h2>
<p>Один з елементів має плинний перехід кольору з використанням функції `min()`.</p>
</div>
<div id="result">
<div class="box"></div>
<div class="box colored"></div>
</div>
#description {
background: #f1f1f1;
padding: 20px;
font-family: Arial, sans-serif;
margin-bottom: 50px;
}
#result {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
}
.box {
width: 200px;
height: 200px;
background: dodgerblue;
margin-right: 20px;
}
.colored {
background: linear-gradient(to right, dodgerblue, coral);
background-size: min(100%, 200%);
transition: background-size 0.5s ease;
}
.colored:hover {
background-size: min(200%, 200%);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.