I have 3 divs arranged vertically with 1px, overlapping borders. When I hover over the bottom div, its whole border is highlighted. However, when I hover over the top or middle divs, the bottom portion of the border is obscured by the div below. How can I fix this? I tried setting z-index
on the hover style, but it doesn't appear to force the div above the other siblings.
.box {
border: 1px solid #ccc;
padding: 0.25em;
width: 100px;
}
.box:nth-child(2) {
margin-top: -1px;
}
.box:nth-child(3) {
margin-top: -2px;
}
.box:hover {
border-color: #000;
z-index: 1 !important;
}
<div class="box">Top</div>
<div class="box">Middle</div>
<div class="box">Bottom</div>