开发者

Sub Pixel CSS positioning

开发者 https://www.devze.com 2023-01-04 23:48 出处:网络
If I set the CSS position attributes of an image element to floating points via javascript, Firefox renders it nicely, but other browsers do not. Can I get sub pixel positioning to work with other bro

If I set the CSS position attributes of an image element to floating points via javascript, Firefox renders it nicely, but other browsers do not. Can I get sub pixel positioning to work with other browsers? I like to seamlessly zoom in on an image, without jittering due to my values getting rounded off. For example开发者_开发百科, it seems like 2.217px; becomes '2px;' in all browsers except for Firefox. This happens with setting the value via style.top or via style.webkit-transform: translate(x, y).


In the end, I've managed this by drawing the image on the HTML5 canvas element.

0

精彩评论

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