QR codes
Last updated
Last updated
A QR code (Quick Response code) is a two-dimensional barcode that can be scanned using a smartphone camera or QR code reader. QR codes are similar to traditional barcodes, but they can store much more information and can be scanned much more quickly.
They are often used to store website URLs, contact information, or other types of data that can be easily accessed by scanning the code.
Codes can be placed on business cards, brochures, advertisements, or other marketing materials. They can also be used in other ways such as for mobile payments, ticketing, and much more. They can also be used to track inventory and assets in industries such as manufacturing and logistics.
CSS and HTML do not include built-in support for QR codes, therefore, it must be obtained from a separate package that needs to be imported specifically if you wish to use it.
To install it, use composer and require typesetsh/qr-code-element
.
After installation, you can include the qr-code
element in your HTML. This element supports the alt
attribute as well as the icon-src
and icon-size
attributes. These can be used to place and adjust the size of an icon in the center of your QR code. The size is represented as an integer, where 1 equals one block size (a single block-bit, so to speak). The content within the qr-code
element represents the data that will be encoded in the QR code.
Please be aware that white spaces are not automatically removed. If you are adding multi-line content for encoding, make sure to avoid using tabs or white spaces for code indentation, as these will also be encoded in the QR code.
data-error-correction-level
Q
Possible values: L: ~7% correction M: ~15% correction Q: ~25% correction H: ~30% correction
data-encoding
UTF-8
Valid encoding, default UTF-8
icon-src
Any image url
icon-size
0
The size of the icon in bit unit. 1 equals the size of 1 square.