Set the background to 100% for display. You can calculate the width of the QR code and 640px based on a fixed value such as margin-top, and finally convert it into the corresponding percentage and center the image.
You can use the background's background-cover to set the background. As for the centering of the QR code, I don't know whether it is centered left and right at a certain position or centered on the entire screen. If it is centered left and right at a certain height, you can use absolute positioning and set Set the value of bottom, and then set left:50%; plus margin-left:宽度/2px; to achieve left and right centering.
If the entire screen is centered, the left and right still follow the above method, and the top and bottom centering can also be achieved according to the left and right centering method.
Set the background to
100%
for display. You can calculate the width of the QR code and640px
based on a fixed value such asmargin-top
, and finally convert it into the corresponding percentage and center the image.You can use the background's
background-cover
to set the background. As for the centering of the QR code, I don't know whether it is centered left and right at a certain position or centered on the entire screen. If it is centered left and right at a certain height, you can use absolute positioning and set Set the value ofbottom
, and then setleft:50%;
plusmargin-left:宽度/2px;
to achieve left and right centering.If the entire screen is centered, the left and right still follow the above method, and the top and bottom centering can also be achieved according to the left and right centering method.