开发者

Browser position:absolute and decimal truncation?

开发者 https://www.devze.com 2023-04-02 08:09 出处:网络
I\'m trying to position individual characters precisely in HTML5 using position: absolute. I\'ve tried specifying the position in % and em, but every browser handles the decimals differently, and dep

I'm trying to position individual characters precisely in HTML5 using position: absolute.

I've tried specifying the position in % and em, but every browser handles the decimals differently, and depending on the zoom level, the output doesn't look great.

e.g. 12.005% and 3.003em may or开发者_高级运维 may not use the decimal portion, depending on the zoom level and size relative the parent.

Does anyone have any ideas on how to solve this problem across chrome/firefox? IE 9 would be nice as well.


I think the problem is that you are using fluid measurements (% and em) to handle positioning.

If you want your position to be the same (mostly) across browsers and screen sizes, then you need to use pixels.

BTW: you should design for the standard 100% zoom level. Everything else is too unpredictable.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号