<img src="https://picsum.photos/id/64/300/300" alt="A random woman">
img {
  --c: #F9CDAD; /* the main color */
  --b: 8px; /* thickness of the border */
  --o: 25px; /* control the offset */
  
  width: 200px; /* the image size */
  --_p: calc(2*var(--o) + var(--b));
  padding: var(--_p) var(--_p) 0 0;
  outline: var(--b) solid var(--c);
  outline-offset: calc(var(--o) - var(--_p));
  transition: .4s;
  cursor: pointer;
  background-color: red;
}

img:hover {
  padding: calc(var(--_p)/2);
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-content: center;
  grid-auto-flow: column;
  grid-auto-columns: 300px;
  background: #547980;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.