<div id="description">
  <h2>Приклад 1: масштабування по осі Z</h2>
  <p>Натисканням на кнопку збільшує елемент вздовж осі Z.</p>
</div>

<div id="result">
  <div class="container">
    <button id="scaleButton">Натисніть для масштабування</button>
    <div class="box"></div>
  </div>
</div>
#description {
  background-color: #eee;
  padding: 20px;
  font-family: Arial, sans-serif;
  font-size: 18px;
}

#result {
  display: flex;
  justify-content: center;
}

.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 300px;
}

.box {
  width: 100px;
  height: 100px;
  background-color: blue;
  transition: transform 0.3s;
}

#scaleButton {
  padding: 10px 20px;
  font-size: 16px;
  background-color: #ddd;
  border: none;
  cursor: pointer;
  margin-bottom: 35px;
}

#scaleButton:hover {
  background-color: #ccc;
}

#scaleButton:focus + .box {
  transform: perspective(400px) translateZ(100px);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.