davidshimjs/qrcodejs

QR Code will not resize on Google Pixel 5/6

Spederan opened this issue · 2 comments

Ive tested it across multiple devices, and it will not set itself to the correct size when resized on a Google pixel 5 or 6, but works fine on everything else. This makes my QR codes too large.

I'm assuming you're generating a bigger QR code, then sizing it using CSS.

On some devices the QR code is generated as a <canvas> element, not as an image.

This means you'll need to apply the CSS to both the image and canvas to ensure it works on all devices:

#qrcode img, #qrcode canvas {
    width: 250px;
    height: 250px;
}

Give #qrcode div a certain width, then:

#qrcode img, #qrcode canvas {
width: 100%; height: auto;
}