Converting between physical pixels and CSS pixels
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Mozilla's documentation from elementFromPoint explains that the coordinates are not in physical pixels, but "CSS pixels". Exactly what are CSS pixels? I was under the impression that a pixel in CSS was the same as the physical pixel. If this is not the case, how does one convert between physical and CSS pixels? 回答1: A pixel is a physical screen pixel as far as any web page can reasonably concern itself. The wording ‘CSS pixel’ refers to a pixel as defined in CSS 2 the whole number of device pixels that best approximates the reference pixel.