子像素CSS定位 [英] Sub Pixel CSS positioning
问题描述
如果我通过javascript将图像元素的CSS位置属性设置为浮点,Firefox会很好地渲染,但其他浏览器不会。我可以获得子像素定位与其他浏览器工作吗?我喜欢无缝放大图像,没有抖动,由于我的价值观四舍五入。例如,除了Firefox之外,在所有浏览器中, 2.217px;
似乎变为'2px;'。这通过 style.top
或通过 style.webkit-transform:translate(x,y)
。
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)
.
推荐答案
最后,我通过在HTML5 canvas元素上绘制图片来管理这个。
In the end, I've managed this by drawing the image on the HTML5 canvas element.
这篇关于子像素CSS定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!