divmodalintermediate

Modal Backdrop

A centered modal dialog with a dark semi-transparent backdrop overlay.

Preview

Confirm Action

Are you sure you want to proceed? This action cannot be undone.

<div class="fixed inset-0 z-50 flex items-center justify-center p-4">
  <div class="fixed inset-0 bg-black/50 backdrop-blur-sm"></div>
  <div class="relative bg-white rounded-2xl shadow-2xl max-w-md w-full p-6">
    <div class="flex items-center justify-between mb-4">
      <h3 class="text-lg font-bold text-gray-900">Confirm Action</h3>
      <button class="text-gray-400 hover:text-gray-600">
        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
      </button>
    </div>
    <p class="text-sm text-gray-600 mb-6">Are you sure you want to proceed? This action cannot be undone.</p>
    <div class="flex justify-end gap-3">
      <button class="px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 rounded-lg transition-colors">Cancel</button>
      <button class="px-4 py-2 text-sm font-medium bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors">Delete</button>
    </div>
  </div>
</div>

Color Breakdown

Backdrop

bg-black/50

#00000080

Modal Background

bg-white

#ffffff

Title

text-gray-900

#111827

Body Text

text-gray-600

#4b5563

Danger Button

bg-red-600

#dc2626

Close Icon

text-gray-400

#9ca3af

Dark Mode Variant

Add these Tailwind classes for a dark mode adaptation of this recipe.

dark:bg-gray-800 dark:text-white dark:text-gray-300

Use Cases

Confirmation dialogsDelete confirmationsAlert dialogs

Browser Support

All modern browsers. Backdrop-blur in Chrome 76+, Firefox 103+, Safari 9+.

Related Recipes

Build Your Own Color Recipe

Use our Tailwind CSS tools to experiment with colors, gradients, and component styles.

Explore Tools

Frequently Asked Questions

How do I close the modal when clicking the backdrop?▼
Add an onClick handler to the backdrop div that hides the modal. Make sure the modal content has relative positioning and stops event propagation.
How do I animate the modal opening?▼
Add scale-95 opacity-0 by default and animate to scale-100 opacity-100 with transition-all duration-200.