<div id="description">
<p>Звичайний блок має синій колір фону та не має зсуву.</p>
<p>Блок з використанням функції <code>translateY()</code> має червоний колір фону та зсувається на 50 пікселів вниз.</p>
</div>
<div class="container">
<div class="block"></div>
<div class="block-translate"></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;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
background-color: #f2f2f2;
}
.block {
width: 100px;
height: 100px;
background-color: blue;
margin: 10px;
}
.block-translate {
width: 100px;
height: 100px;
background-color: red;
margin: 10px;
transform: translateY(50px);
}
.description {
font-size: 16px;
color: #333;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.