css - Pixel distortion when rendering 1px squares on mobile (React) - Stack Overflow

I'm working on a project using React where I render individual pixels aselements (orin some ca

I'm working on a project using React where I render individual pixels as elements (or in some cases). However, on mobile devices, some pixels appear distorted—they stretch into rectangles rather than staying as perfect squares.

Here’s a simplified snippet of how I render each pixel:

<div
    style={{
        position: "absolute",
        top: pixelPosition.y * PIXEL_SIZE,
        left: pixelPosition.x * PIXEL_SIZE,
        width: `${PIXEL_SIZE}px`,
        height: `${PIXEL_SIZE}px`,
        backgroundColor: `${selectedColor}`,
        boxSizing: "border-box",
        pointerEvents: "none",
        imageRendering: "pixelated"
    }}
/>

Even though PIXEL_SIZE is set to 1px, some pixels appear stretched on certain mobile screens.

I’ve attached an image showing the issue.

Desktop Mobile

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745110338a4611809.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信