<div class="wrapper">
  <figure class="fig-panel">
    <img src="https://assets.codepen.io/12005/bristol-harbor.jpg">
    <img src="https://assets.codepen.io/12005/suspension-bridge.jpg">
    <img src="https://assets.codepen.io/12005/tk-balloon1.jpg">
    <figcaption class="caption">Bristol is a pretty nice place to live.</figcaption>
  </figure>

<div class="container-sm">
  <figure class="fig-panel">
    <img src="https://assets.codepen.io/12005/bristol-harbor.jpg">
    <img src="https://assets.codepen.io/12005/suspension-bridge.jpg">
    <img src="https://assets.codepen.io/12005/tk-balloon1.jpg">
    <figcaption class="caption">Bristol is a pretty nice place to live.</figcaption>
  </figure>
</div>

</div>

:root {
  --light-gray: hsla(300, 4%, 81%, 1);
  --ghost-white: hsla(225, 100%, 99%, 1);
  --davys-grey: hsla(12, 5%, 36%, 1);
  --blue-sapphire: hsla(196, 67%, 33%, 1);
  --charcoal: hsla(207, 38%, 25%, 1);
}
/* from https://coolors.co/d0ccd0-fbfcff-605856-1c6e8c-274156*/

img {
  max-width: 100%;
  display: block;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--charcoal);
  font: 1.2em/1.3 Roboto, sans-serif;
}

.wrapper {
  box-sizing: border-box;
  margin: 100px auto;
  background-color: var(--ghost-white);
  container-type: inline-size;
}

.container-sm {
  inline-size: 400px;
  container-type: inline-size;
}

.fig-panel {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.fig-panel :nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

.fig-panel :nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}
.fig-panel :nth-child(3) {
  grid-column: 1/3;
  grid-row: 2 /4;
}

.fig-panel img {
  aspect-ratio: 1/1;

  height: 100%;
  width: 100%;
  object-fit: cover;
}

.fig-panel .caption {
  padding: 0.3em;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  grid-row: 3;
  grid-column: 1 / 3;
}

@container (min-width: 700px) {
  .fig-panel {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr auto;
    padding: 40px;
    margin: 0;
    list-style: none;
  }

  .fig-panel :nth-child(1) {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .fig-panel :nth-child(2) {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .fig-panel :nth-child(3) {
    grid-column: 3;
    grid-row: 1 / 3;
  }

  .fig-panel .caption {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}
Run Pen

External CSS

  1. https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400;1,700&amp;display=swap

External JavaScript

  1. https://unpkg.com/browse/container-query-polyfill@0.0.1/cqfill.iife.min.js