<div id="description">
<h2>Приклад 1: зміна кольору при наведенні</h2>
<p>Наведіть курсор на квадрат, щоб змінити його кольору.</p>
</div>
<div id="result">
<div class="square"></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;
}
.square {
width: 200px;
height: 200px;
background-color: rgb(0, 0, 255);
transition: background-color 0.5s;
}
.square:hover {
background-color: rgb(255, 0, 0);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.