<div style="display: flex; gap: 20px;">
<div class="double_box"></div>
<div class="double_box_demo"></div>
</div>
.double_box {
position: relative;
border: 1px solid #0f0;
width: 200px;
height: 100px;
cursor: pointer;
&::before,
&::after {
content: "";
position: absolute;
width: 20px;
height: 20px;
transition: 0.2s ease-in-out;
}
&::before {
top: -5px;
left: -5px;
border-top: 1px solid #0f0;
border-left: 1px solid #0f0;
}
&::after {
right: -5px;
bottom: -5px;
border-bottom: 1px solid #0f0;
border-right: 1px solid #0f0;
}
&:hover::before,
&:hover::after {
width: calc(100% + 9px);
height: calc(100% + 9px);
}
}
.double_box_demo {
position: relative;
border: 1px solid #0f0;
width: 200px;
height: 100px;
cursor: pointer;
&::before,
&::after {
content: "";
position: absolute;
width: 20px;
height: 20px;
transition: 1s ease-in-out;
}
&::before {
top: -5px;
left: -5px;
border: 1px solid #0f0;
}
&::after {
right: -5px;
bottom: -5px;
border: 1px solid #0f0;
}
&:hover::before,
&:hover::after {
width: calc(100% + 9px);
height: calc(100% + 9px);
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.