<div id="description">
  <h2>Приклад 2: колорові та розмірні варіації</h2>
  <p>Використання функції clamp() для зміни розмірів елементa.</p>
</div>

<div id="result">
  <div class="box"></div>
  <div class="box with-clamp"></div>
</div>
#description {
  background-color: #f1f1f1;
  padding: 20px;
  font-family: Arial, sans-serif;
}

#result {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.box {
  width: 200px;
  height: 200px;
  background-color: #ff6f61;
  margin-right: 20px;
}

.with-clamp {
  width: clamp(100px, 50%, 300px);
  height: clamp(100px, 50%, 300px);
  background-color: #5cb85c;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.