As you know, you can specify dimensions with CSS in px or em. As far as I understand it, em means “line height of the current element’s fonts”. My approach currently is to always use px (also for margin which seems to be a controversial practice).
Question: Can I rely on the ratio of px and em to be the same across browsers? If not, then my manually specified margins between paragraphs will likely look odd because they so not match 1em anymore.
I believe that it is better to use em for margins but I have quite a base of existing code that always uses px margins.
No, you cannot.
The size of
emin pixels is related to the font type & size you’re using, the resolution of your screen (depending on OS, browser), and possible further OS and browser settings – eg “Show fonts +10%” may alter theemvalue.