My demonstration shows two lines that should appear equal in height, but one ends up looking thicker due to its top position. Even just adjusting the top position by 1px can make a significant difference in how they look. Is there any way to prevent this unexpected behavior?
.a {
position: absolute;
top: 0;
}
.line {
width: 300px;
height: 1px;
background: red;
position: absolute;
top: 5px;
box-sizing: border-box;
}
.line2 {
width: 300px;
height: 1px;
background: red;
position: absolute;
top: 11px;
box-sizing: border-box;
}
<div class="a">
<div class="line"></div>
<div class="line2"></div>
</div>