Ein modernes Modalfenster, das den Hintergrund wie Milchglas durchscheinen lässt.
This is a beautiful glassmorphism modal popup using Tailwind CSS backdrop-blur utilities.
<!-- Container with background to demonstrate glass effect -->
<div class="relative w-full h-screen bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center">
<button id="open-modal" class="px-6 py-2 bg-white/20 hover:bg-white/30 backdrop-blur-md text-white font-medium rounded-lg border border-white/30 transition-all">Open Modal</button>
<div id="glass-modal" class="fixed inset-0 z-50 flex items-center justify-center p-4 opacity-0 pointer-events-none transition-opacity duration-300">
<!-- Overlay -->
<div class="absolute inset-0 bg-black/20 backdrop-blur-sm"></div>
<!-- Modal Box -->
<div class="relative bg-white/20 dark:bg-black/30 backdrop-blur-xl border border-white/30 dark:border-white/10 rounded-2xl p-8 max-w-sm w-full shadow-2xl transform scale-95 transition-transform duration-300">
<h3 class="text-xl font-bold text-white mb-2">Glassmorphism</h3>
<p class="text-white/80 mb-6 text-sm">This is a beautiful glassmorphism modal popup using Tailwind CSS backdrop-blur utilities.</p>
<button id="close-modal" class="w-full py-2 bg-white/20 hover:bg-white/30 text-white rounded-lg transition-colors font-medium border border-white/20">Close</button>
</div>
</div>
</div>
<script>
const modal = document.getElementById('glass-modal');
const inner = modal.querySelector('.transform');
document.getElementById('open-modal').addEventListener('click', () => {
modal.classList.remove('opacity-0', 'pointer-events-none');
inner.classList.remove('scale-95');
inner.classList.add('scale-100');
});
document.getElementById('close-modal').addEventListener('click', () => {
modal.classList.add('opacity-0', 'pointer-events-none');
inner.classList.add('scale-95');
inner.classList.remove('scale-100');
});
</script>