Articles in this section
Category / Section

How to render QR code at center of the div in JavaScript platform

2 mins read

Syncfusion JavaScript Barcode control allows you to easily generate QRCode on your application.

To render QR code at center of the div, we need to follow the below steps.

Step 1: Create QR Code using QrCodeGenerator

You can use the Syncfusion Barcode control’s QrCodeGenerator to generate QR code.

Step 2: Add style to div

To center the QR Code add style to the div

  <style>
  /* position barcode at center */
     #element {
       position: absolute;
       top: 50%;
       left: 50%;
       transform: translate(-50%, -50%);
     }
     .barcodeStyle {
       height: 400px;
       width: 400px;
       background-color: #acf1e9;
       position: absolute;
     }
   </style>
  
   <div id="container" class="barcodeStyle">
     <div id="element"></div>
   </div>
  

Sample: Click here for sample

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied