Sub Pixel CSS positioning

2019-08-20 03:17发布

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).

1条回答
Evening l夕情丶
2楼-- · 2019-08-20 04:00

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

查看更多
登录 后发表回答