<div class="wrap-image">
  <img src="https://picsum.photos/200/300" alt="">
</div>
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
}

.wrap-image {
  position: relative;
  &::before,
  &::after {
    content: "";
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: -1;
    border: 2px solid yellow;
    transition: all .25s ease-out;
  }
  &::before {
    background-color: yellow;
    top: -15px;
    left: -15px;
  }
  &::after {
    bottom: -15px;
    right: -15px;
  }
  &:hover {
    &::before {
      top: 15px;
      left: 15px;
    }
    &::after {
      bottom: 15px;
      right: 15px;
    }
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.