<div class="container">
    <div class="item">CONTENT</div>
    <div class="item">CONTENT</div>
    <div class="item">CONTENT</div>
    <div class="item">CONTENT</div>
    <div class="item">CONTENT</div>
</div>
.container { 
    padding: 20px;
    margin: 20px;
    border: 1px solid black;
}

.item {
    position: relative;
    margin-top: -2px;
    width: 300px;
    height: 50px;
    border-left: 2px solid #000;
    border-right: 2px solid #000;
}

.item:before {
    position: absolute;
    content: "";
    height: 2px;
    display: block;
    background-color: black;
    width: 100%;
}

.item:after {
    position: absolute;
    bottom: 0;
    content: "";
    height: 2px;
    display: block;
    background-color: black;
    width: 100%;
}

.item:hover::before, .item:hover::after{
    z-index: 100;
    background: red;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.