<section>
  <div class="grid__container">
    <div class="grid__item">
      <img src="https://picsum.photos/300/150?random=3" alt="" />
    </div>
    <div class="grid__item">Tony</div>
    <div class="grid__item">
      <img src="https://picsum.photos/300/150?random=1" alt="">
    </div>
  </div>
</section>

<form action="">
  <label for="width">width:</label>
  <input type="range" min="20" max="100" value="100" id="width" name="width" />
  <output id="width-output">100%</output>
</form>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  min-height: 100vh;

  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  font-family: "Exo", Arial, sans-serif;
  background-color: #f7f7f7;

  padding: 20px;
}

section {
  width: 100%;
  margin: 0 auto;

  display: flex;
  justify-content: center;
  align-items: center;
}

.grid__container {
  border: 1px dashed #f36;
  box-shadow: 0 0 0 6px rgb(0 0 0 / 13%);
  border-radius: 1px;
  position: relative;
}

.grid__item {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f7f7f7;
  font-size: 2rem;
  color: #fff;
  text-shadow: 1px 1px 0 rgb(0 0 0 / 0.5), -1px -1px 0 rgb(0 0 0 / 0.05);
  font-weight: 500;
  caret-color: #f36;
}

.grid__item:nth-child(1) {
  background-color: #f1c2c6;
}

.grid__item:nth-child(2) {
  background-color: #dac2f1;
}

.grid__item:nth-child(3) {
  background-color: #ccf1c2;
}

.grid__item:nth-child(4) {
  background-color: #c2e9f1;
}
.grid__item:nth-child(5) {
  background-color: #09f;
}
.grid__item:nth-child(6) {
  background-color: #f36;
}

form {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.grid__container {
  --width: 100%;
  display: grid;
  gap: 4px;
  grid-template-columns: min-content 1fr max-content;
}

.grid__container img {
  width: var(--width, 100%);
  aspect-ratio: 2 / 1;
}
const input = document.getElementById("width");
const container = document.querySelector(".grid__container");
const output = document.getElementById("width-output");

input.addEventListener("input", (etv) => {
  container.style.setProperty(`--${etv.target.id}`, `${etv.target.value}%`);
  output.textContent = `${etv.target.value}%`;
});
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.