I am using REM values. At smaller screen sizes my base font-size is equivalent to 9 pixels:
html {
font-size: 56.25%;
}
(16px x 56.25% = 9px)
I have noticed that Chrome calculates the pixel values differently depending on what is being measured. For example:
I have a <header> element. The height of which is decided by the line-height: 6.3rem (6.3 x 9px = 56.7px).
header { line-height: 6.3rem }
Chrome calculates this as 57px.
However, if I change the code to
header { height: 6.3rem; }
Chrome calculates this as 57.69px.
If I have a nav positioned absolutely just under the header:
nav { position: absolute; top: 6.3rem; }
Chrome calculates the top distance as 56.7px
These differences are proving a pain as the header and nav have different background colours and a border and Chrome is renduring these sub-pixel differences.
Why would a browser render the same measurement differently?
JSFiddle here: https://jsfiddle.net/79tbdovq/1/
In Chrome there is a sub-pixel border-bottom displayed, that shouldn't display. Although for some reason in JSFiddle it works fine.