Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                
<head> 
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/imask"></script>
    <style>
        /* Additional styles if needed */
    </style>
</head>
<body class="bg-gray-100 flex items-center justify-center h-screen">
    <div class="bg-white p-8 rounded-lg shadow-lg max-w-md w-full">
        <form id="contactForm" class="space-y-4">
            <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY_HERE">
            <div>
                <label for="name" class="text-gray-700">Name</label>
                <input type="text" id="name" name="name" placeholder="Your Name" class="mt-1 block w-full border-b border-gray-100 shadow-sm py-1 focus:outline-none focus:border-blue-500">
            </div> 
            <div>
                <label for="email" class="text-gray-700">Email</label>
                <input type="email" id="email" name="email" placeholder="Your Email" class="mt-1 block w-full border-b border-gray-100 shadow-sm py-1 focus:outline-none focus:border-blue-500">
            </div>
            <div>
                <label for="phone" class="text-gray-700">Phone</label>
                <input type="text" id="phone" name="phone" placeholder="(123) 456-7890" class="mt-1 block w-full border-b border-gray-100 shadow-sm py-1 focus:outline-none focus:border-blue-500">
            </div>
            <div>
                <button type="submit" class="w-full bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50">
                    Submit Form
                </button>
            </div>
        </form>
    </div>

</body>
 
              
            
!

CSS

              
                
              
            
!

JS

              
                  // Initialize the phone number mask
        var phoneMask = IMask(
            document.getElementById('phone'), {
                mask: '(000) 000-0000'
            }
        );

        // Handle form submission
        document.getElementById('contactForm').addEventListener('submit', function(event) {
            event.preventDefault();
          
          fetch('https://api.web3forms.com/submit', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'Accept': 'application/json'
            },
            body: json
        })
        .then(async (response) => {
            let json = await response.json();
            if (response.status == 200) {
                alert('Form submitted!');
            } else {
                console.log(response);
                alert('Something went Wrong!');
            }
        })  
        });
              
            
!
999px

Console