The general problem I am trying to solve is the alignment of stacked boxes (<div>
) when some of them have a different border width.
Consider the two boxes below
.box {
border-style: solid;
border-color: green;
width: 100px;
height: 100px;
}
.thick {
border-width: 30px;
}
<div class="box"></div>
<div class="box thick"></div>
They are both of the same sizes, but the border is growing out of the box, breaking their alignment.
I can compensate for this with some tricks (shifting the box, having a thick transparent border, ...) but I would ideally like to keep the total size fixed, and grow the border "in".
Is this possible?