<figure>
  <img src="https://assets.codepen.io/2222/kitty-apples-box.webp" alt="Kitty and apples sitting in a box together" />
  <figcaption>
    <h2>Kitty and apples</h2>
    <p>My cats hanging out in a box together</p>
  </figcaption>
</figure>
figure {
  --pad: 2rem;
  display: grid;
  grid-template-columns: 20rem 1fr;
  gap: var(--pad);
  padding: var(--pad);

  border: .5rem solid salmon;
  
  color: white;
}

figure img {
  inline-size: 100%;
  block-size: 100%;
  aspect-ratio: 1;
  
  object-fit: cover;
  object-position: top left;
}

body {
  display: grid;
  place-items: center;
  
  background: #2e2e2e;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.