I am using rems across all my project to calculate both font sizes and elements dimentions. The base html font-size used to be set at 10px. When I changed to 11 for design reasons, I noticed that a repeated line of .2rem height was not displayed consistently. Here is a codepen that can reproduce the issue: https://codepen.io/jalef/pen/djeoxK . If the html font-size is changed from 10 to 11 the same thing happens.
html {
font-size: 11px;
}
.line {
height: .2rem;
width: 50rem;
background-color: purple;
margin: 1rem;
}
The consistent .2rem height lines that are produced when html font-size is set to 10px:
The inconsistent .2rem height lines that are produced when html font-size is set to 11px:
Is there a reason why this is happening and is there a way to resolve it?
Thanks!