<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
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.