<div id="description">
<p>При наведенні курсору на блок, він зсувається на -100px по осі Z за допомогою функції translate3d().</p>
</div>
<div id="result">
<div class="block"></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 {
height: 200px;
background-color: #F2F2F2;
position: relative;
}
.block {
width: 100px;
height: 100px;
background-color: #FFC107;
position: absolute;
top: 50%;
left: 50%;
transition: transform 0.3s ease;
}
#result:hover .block {
transform: translate3d(-50%, -50%, -100px);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.