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

              
                <!-- Tailwind CSS -->    
<script src="https://cdn.tailwindcss.com"></script>
<!-- Alpine.js -->
<script src="//unpkg.com/alpinejs" defer></script>

<!-- Align -->
<div class="w-full h-screen flex items-center justify-center">
    <div x-data="{ open: false }">
      <button
        @click="open = true"
        class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-700 focus:outline-none focus:bg-blue-700"
      >
        Open Modal
      </button>
      <div
        @keydown.escape.window="open = false"
        class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
        x-show="open"
        x-cloak
        style="display: none"
      >
        <!-- Modal -->
        <div class="flex items-center justify-center min-h-screen">
          <div
            class="bg-white p-6 rounded-lg overflow-hidden shadow-xl transform transition-all sm:max-w-lg sm:w-full"
            @click.away="open = false"
            x-transition:enter="ease-out duration-100"
            x-transition:enter-start="opacity-0"
            x-transition:enter-end="opacity-100 scale-100"
            x-transition:leave="ease-in duration-200"
            x-transition:leave-start="opacity-100 scale-100"
            x-transition:leave-end="opacity-0"
          >
            <!-- Modal header -->
            <div class="flex items-start justify-between">
              <div class="text-left">
                <h3 class="text-lg leading-6 font-medium text-gray-900">
                  Title
                </h3>
                <div class="mt-1">
                  <p class="text-sm text-gray-500">
                    Your modal description goes here
                  </p>
                </div>
              </div>
              <span class="cursor-pointer" @click="open = false">✕</span>
            </div>

            <!-- Modal body -->
            <div class="text-left my-2">
              <p class="text-sm text-black">Your modal body goes here</p>
            </div>

            <!-- Modal footer -->
            <div class="flex items-center justify-end gap-2 mt-4">
              <button
                type="button"
                class="w-full inline-flex justify-center rounded-md border border-blue-500 px-4 py-2 text-base font-medium text-blue-500 hover:text-white hover:border-blue-400 hover:bg-blue-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:w-auto sm:text-sm"
                @click="open = false"
              >
                Close
              </button>
              <button
                type="button"
                class="w-full inline-flex justify-center rounded-md border border-transparent px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:w-auto sm:text-sm"
                @click="open = false"
              >
                Accept
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
</div>
              
            
!

CSS

              
                [x-cloak] {
  display: none !important;
}
              
            
!

JS

              
                
              
            
!
999px

Console