Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://cdn.rawgit.com/amanuel/JS-HTML5-QRCode-Generator/master/qrcode.js"></script>
<script src="https://cdn.rawgit.com/amanuel/JS-HTML5-QRCode-Generator/master/html5-qrcode.js"></script>

<body>
      <div class="relative flex flex-col justify-center min-h-screen py-6 overflow-hidden bg-gray-50 sm:py-12">
        <img src="https://play.tailwindcss.com/img/beams.jpg" alt="" class="absolute -translate-x-1/2 -translate-y-1/2 top-1/2 left-1/2 max-w-none" width="1308" />
    <div class="absolute inset-0 bg-[url(https://play.tailwindcss.com/img/grid.svg)] bg-center [mask-image:linear-gradient(180deg,white,rgba(255,255,255,0))]"></div>
    <div class="relative px-6 pt-10 pb-8 bg-white shadow-xl ring-1 ring-gray-900/5 sm:mx-auto sm:max-w-lg sm:rounded-lg sm:px-10">
    <div class="max-w-md mx-auto space-y-4">
        <h1 class="text-4xl font-bold">Wifi Password QR Code</h1>
        <form class="flex flex-col space-y-4" id="form">
            <div class="grid grid-cols-1 gap-6">
                <div class="grid grid-cols-1 gap-6 print:hidden">
                    <label class="block">
                        <span class="text-gray-700">SSID:</span>
                        <input class="block w-full mt-1" type="text" id="ssid" placeholder="WiFi Name (SSID)">
                    </label>
                    <label class="block">
                        <span class="text-gray-700">Password:</span>
                        <input class="block w-full mt-1" id="password" type="password" placeholder="Password">
                    </label>
                    <label class="block">
                        
                        <span class="text-gray-700">Encryption:</span>
                        <select class="block w-full mt-1" id="enc">
                            <option>WPA</option>
                            <option>WEP</option>
                        </select>
                    </label>
                    <label class="block">
                        <span class="text-gray-700">Is Hidden?</span>
                        <input class="block mt-1" type="checkbox" id="hidden">
                    </label>
                </div>

                <span id="qrcode" class="py-0 rounded-xl bg-gradient-to-r from-pink-500 via-teal-500 to-purple-500 ">
                </span>
                <div class="print:hidden">
                    <div class="flex flex-row space-x-2 ">
                    <button id="print" class="inline-flex items-center justify-center px-4 py-2 text-base font-bold text-white transition-all bg-gray-900 border border-gray-600 max-w-fit rounded-xl hover:text-white hover:bg-sitehost-milford hover:border-sitehost-milford group text-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2" onclick="window.print()">Print</button>
                </div>
                </div>
            </div>
        </form>
    </div>
    </div>
    </div>

  

</body>
              
            
!

CSS

              
                /* h1,
form,
#qrcode {
  width: 395px;
  margin: 2rem auto;
  font: 16px sans-serif;
} */

/* h1 {
  font-size: 64px;
  border-bottom: 1px solid black;
} */

h1,
label,
button {
  display: flex;
  width: 100%;
  margin-bottom: 1rem;
  justify-content: center;
}

label > * { flex: 1; }
label > span {
  max-width: 8rem;
  margin-right: 1rem;
}

@media print {
  #print { display: none; }
  label,
  input,
  select {
    border: none;
    background: none;
    font-size: 24px;
  }
}
              
            
!

JS

              
                function updateQRCode() {
   var ssid = document.getElementById("ssid").value;
   var pw = document.getElementById("password").value;
   var enc = document.getElementById("enc").value;
   var hidden = document.getElementById("hidden").checked;
   var qrcode = document.getElementById("qrcode");

   var text = "WIFI:S:" + ssid + ";T:" + enc + ";P:" + pw + ";H:" + hidden + ";;";

   qrcode.replaceChild(showQRCode(text), qrcode.lastChild);
}

document.getElementById("form").onchange = updateQRCode;
              
            
!
999px

Console