I have two unique boxes set up like this:
<div id="box1"></div>
<div id="box2"></div>
The second box, box2, has a border and I'm looking to cover the top border with box1. To achieve this, I've applied a negative margin-bottom for box1 so it aligns properly as shown here:
box1 {
background-color: white;
margin-bottom: -1px;
}
box2 {
background-color: yellow;
border: 1px solid red;
}
Unfortunately, my attempted solution doesn't work because box1 is positioned behind box2. Is there a way to change the stacking order without using z-index (which requires position absolute)? Can this be achieved using CSS alone?
Thanks in advance.