em vs px… for mobile browsers

前端 未结 5 2167
醉酒成梦
醉酒成梦 2021-02-01 20:26

For desktop browser all modern browser uses Zoom functionality so we can use PX but if same site can be seen on mobile then would px not be good for zooming in mobile browsers.

5条回答
  •  名媛妹妹
    2021-02-01 20:32

    I recommend not to use pixel precision designs generally and particularly when developing for mobile devices. The reasons are simple:

    • You're dealing with devices with screens ranging from tiny resolutions to > 1920x1080 and there is no 'one size fits all' approach; also consider that your users might not know that a zoom function even exists in their browsers.
    • When developing for mobile devices be aware that not many of them support a wide variety of font sizes, so you cannot rely on pixel precise fonts. Line-height is not supported at all by some mobile browsers. Thus if your design relies on pixel precision for, say a menu bar, and you design the bar to be x pixels high, the result may look completely wrong.

    Dan Cederholm's book "Bulletproof Web Design" may not be quite as bulletproof as the title suggests, but it's a really good start for answering your question/ solving your problem.

提交回复
热议问题