I am trying to add an element on all the 4 sides of the div. I don't want to use box-sizing as I have to apply event listeners on the elements that I would place on all the 4 sides.
I am able to add it to the left and right but how can I add it on all the 4 sides? And this also is not an elegant way.
.box {
width: 100px;
height: 100px;
background: yellow;
text-align: center;
font-size: 0.8rem;
position: relative;
}
#sideEl {
background-color: red;
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 4px;
height: 100%;
cursor: w-resize;
}
#sideEl2 {
background-color: red;
position: absolute;
right: 0;
bottom: 0;
width: 4px;
height: 100%;
cursor: w-resize;
}
<div class="box">
<div id="sideEl">
<div id="sideEl2">
</div>
I had referred Placing 4 html elements in every corner of a div . But not able to get an idea how to place them along side borders