kozakdenys / qr-code-styling

Automaticly generate your styled QR code in your web app.
https://qr-code-styling.com
MIT License
1.56k stars 497 forks source link

Is it possible to extent the qr code to fill the canvas #166

Open technetium opened 1 year ago

technetium commented 1 year ago

I have a responsive design, the size of the canvas where I want to show the QR code can vary. How to I make the QR code the same size as the canvas.

I've tried setting the width and height to:

Has anybody another suggestion?

jzombie commented 1 year ago

A solution that worked for me was generating a fixed size canvas, i.e. 300x300, and applying CSS scaling to it, which dynamically updates to fill it in w/ the parent node.

https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale

lyqht commented 1 year ago

A solution that worked for me was generating a fixed size canvas, i.e. 300x300, and applying CSS scaling to it, which dynamically updates to fill it in w/ the parent node.

https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale

Hey @jzombie do you have a codesandbox for the solution you mentioned? I couldn't make it work