
Clean Login / Signup Overlay
<dialog> flips between Sign in and Create account with pure-CSS tabs, floating-label inputs and a blurred backdrop. The most-searched auth modal, built the accessible way.Published
36 copy-paste CSS modal templates for SaaS auth, Stripe payment, HIPAA consent, GDPR cookies, subscription paywalls, cart drawers, and Cmd+K command palettes — 18 new native <dialog> demos with automatic focus trap + Escape close + inert background + ::backdrop blur + @starting-style enter/exit animation, plus 18 original custom-CSS overlays with the WCAG 2.1 dialog pattern hand-wired. Compliance callouts embedded per demo: PCI DSS SAQ-A, HIPAA 45 CFR § 164, GDPR Article 7, NIST SP 800-63B, PSD2 SCA, CCPA, FTC 16 CFR § 425 (paywall auto-renewal). Scoped under .cm-NN (new native <dialog>) and .md-NN (original CSS+JS) for no-collision pasting, prefers-reduced-motion guarded, framework-agnostic.
Related28 CSS Close Buttons30 CSS Login Forms20 CSS Popovers

<dialog> flips between Sign in and Create account with pure-CSS tabs, floating-label inputs and a blurred backdrop. The most-searched auth modal, built the accessible way.Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

Published

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

rotate3d flips like origami paper unfolding. The animation communicates the modal's core purpose (revealing your consent categories layer by layer) rather than being decorative theater. Neutral gray palette — legal compliance surfaces should be sober, not persuasive. Accept All / Reject All / Save Preferences with EQUAL visual weight (CNIL fined dark-pattern-favoring-Accept in 2022).PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

PublishedUpdated

ease-out, no bounce, no scale. Reads as "a document being placed on the desk" rather than the pure fade Demo #05 HIPAA uses. Distinct but still institutional. Scrollable TOS body with version tag, explicit unchecked "I have read and agree" checkbox, separate marketing consent checkbox (never bundled), Accept + Decline actions with equal visual weight.PublishedUpdated

PublishedUpdated
<div class='backdrop' role='dialog' aria-modal='true' aria-labelledby='modal-title'> wrapping <div class='modal'>. CSS: backdrop is position: absolute; inset: 0 with background: rgba(0,0,0,.6) + backdrop-filter: blur(4px) + opacity: 0; visibility: hidden in closed state, animated to opacity: 1; visibility: visible when a .is-open class is toggled. The inner modal is display: flex; align-items: center; justify-content: center centered, with max-width constraint. Modal transitions in with opacity + transform: translateY(20px) scale(.98) → translateY(0) scale(1) for a subtle physical arrival. JavaScript (~25 lines): on open, save current focus (lastFocus = document.activeElement), add .is-open class, set document.documentElement.style.overflow = 'hidden' to lock body scroll, focus the first interactive element inside the modal. On close (via Escape key, backdrop click, or close button), remove class, restore scroll, restore focus to lastFocus. Critical accessibility requirements (WCAG 2.1): role='dialog' tells screen readers this is a dialog, aria-modal='true' tells them the rest of the page is inert, aria-labelledby points to the modal's heading so screen readers announce it, Escape key closes (SC 2.1.1), backdrop click closes with target check (event.target === backdrop) so clicks INSIDE the modal don't close it. Every demo in this collection ships this exact pattern..md-NN class names so multiple can coexist on the same page without conflicts.lastFocus = document.activeElement). This is the element you'll return focus TO when the modal closes. (2) Move focus INTO the modal to the FIRST interactive element — this is context-dependent. For destructive confirmations, focus the SAFE action (Cancel button, never Delete). For auth forms, focus the first input (email). For informational modals, focus the modal's close button. Never focus the modal container itself — screen readers won't announce it properly. (3) Trap Tab and Shift+Tab within the modal. Listen for keydown on Tab, find all focusable elements inside the modal (button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])), if user is on the last element and pressed Tab (or first element and pressed Shift+Tab), preventDefault + wrap focus. (4) On modal close (via Escape, backdrop click, or close button), restore focus to lastFocus. This ensures the user returns to exactly where they were — critical for screen reader users. Escape key handling: add keydown listener that closes on Escape, but for high-effort forms (payment, signup), prompt for confirmation first (if (form.hasUnsavedChanges) return confirm('Leave without saving?')). Testing: use screen reader (VoiceOver on macOS with Cmd+F5, NVDA on Windows) to verify announcements. Every JS demo in this collection ships the focus-return pattern; production-hardening the Tab trap requires ~15 additional lines shown in Demo #04's expanded JS.role='dialog' announces "dialog" when opened. aria-modal='true' tells the screen reader the rest of the page is inert (in supporting browsers, ARIA-modal + focus trap combined create the correct inert experience). aria-labelledby='modal-title-id' points to the modal's heading — screen readers read this as the modal's accessible name. aria-describedby='modal-desc-id' optionally points to a longer description read after the title. Semantic HTML matters: the modal's title should be a real <h2> (or contextually correct heading level), close button should be a real <button> with aria-label='Close' or visible text "Close". Never use icon-only close buttons without aria-label: a bare <button>✕</button> is announced as "button" with no context. Always include aria-label='Close dialog' or a visually-hidden text child. Body inert trick: for stronger screen reader support in older browsers, add aria-hidden='true' to the main page content when modal opens (via a wrapper div), and remove on close. HTML5 also has inert attribute (Chrome 102+, Safari 15.5+, Firefox 112+) that makes an element completely non-interactive AND non-focusable — the modern replacement for aria-hidden. Announce dynamic content: if the modal shows form validation errors, use aria-live='polite' region so errors are announced without interrupting current speech. Every demo in this collection ships role='dialog' + aria-modal + aria-labelledby minimum. For interactive modals with dynamic content (payment 3DS challenge, signup validation), extend with aria-live regions per the specific interaction.<dialog> element is now widely supported (Chrome 37+, Safari 15.4+, Firefox 98+) and provides native modal semantics without custom JavaScript. Native <dialog> advantages: (1) Automatic focus management — dialog.showModal() moves focus into the dialog and traps Tab automatically. (2) Automatic Escape-to-close — the browser handles it. (3) Automatic backdrop styling via the ::backdrop pseudo-element. (4) Automatically inert underlying page — user can't interact with anything outside the dialog. (5) Automatic aria-modal semantics. (6) Native modal centered positioning. Native <dialog> limitations: (1) Styling ::backdrop is limited — you can't add a blur filter that also blurs the dialog (backdrop-filter interactions are quirky). (2) Animation is harder — <dialog> transitions from display: none to display: block, which historically breaks CSS transitions. The 2024 workaround uses @starting-style + transition-behavior: allow-discrete (Chrome 117+, Safari 17.4+, Firefox 129+). (3) Older browsers (pre-2022) don't support it — you need polyfill (dialog-polyfill, ~3KB) OR custom modal. (4) Custom close animations require more coordination. Recommendation: for internal tools + modern-browser audiences, use <dialog> — less code, more accessibility for free. For public-facing marketing sites needing broad browser support + custom animations, use the custom CSS modal pattern in this collection. Demo #15 Order Success Confirmation Modal in this collection is Pure CSS using :target selector — no JS at all — as an alternative pattern for simple info modals. For the other 17 demos, custom JS gives cleaner animation control and broader browser support than <dialog>.<DialogContent> as pure styling. The accessibility contract is handled by the primitive; our CSS provides the visual layer.<script src='https://js.stripe.com/v3/'>) — this is required for PCI DSS SAQ-A compliance (the lowest tier — you only handle tokens, never PANs). (2) Replace card number/expiry/CVC inputs with Stripe Elements iframes (elements.create('card')). Stripe hosts the actual inputs inside iframes on THEIR domain, so card data never touches your form. (3) On submit, call stripe.confirmCardPayment(clientSecret, {payment_method}) — you get a payment intent, never a card number. (4) Your server only handles the payment_method_id token, which is safe. 3D Secure 2 (SCA — Strong Customer Authentication): required for EU/UK transactions per PSD2 regulation since September 2019. Stripe.js handles this automatically — but your modal must gracefully handle the redirect/iframe flow (Stripe opens a challenge modal ON TOP of yours). Design accordingly. Autofill compatibility: autocomplete='cc-number' / cc-exp / cc-csc / cc-name / postal-code attributes are MANDATORY for Apple Pay / Google Pay / iCloud Keychain autofill. Missing these tanks mobile checkout conversion 40-60% — this is measured on real e-commerce data by Stripe. Demo #04 in this collection ships the exact Stripe Elements-style visual layout with all required autocomplete attributes and payment-method icon strip. The Stripe.js integration is straightforward — replace the <input> elements with Stripe Element mount points, keep everything else.#3b82f6 primary) + mint (#10b981) for positive states. NEVER use dark UI for medical consent — patient trust research (Kaiser Permanente 2019 study) shows light/clean design reads as more trustworthy than dark. Use a bottom sheet modal (slide up from bottom) on mobile — the pattern used by MyChart, Zocdoc, Teladoc. Compliance trap: bundling multiple consents ("I agree to sharing PHI AND to receive marketing emails") violates HIPAA — each disclosure requires separate consent. Demo #05 HIPAA Patient Consent Modal in this collection ships the compliant structure with real-sounding PHI disclosure copy + medical blue palette + separate consent checkboxes. Verify with your Privacy Officer + HIPAA counsel before production deployment — the demo is a starting point, not legal advice.navigator.globalPrivacyControl) that pre-declines marketing/analytics — respect it. California requires it as of July 2023. Demo #07 GDPR Cookie Preferences Modal in this collection ships the equal-weight 3-button pattern + per-category toggles + separate consent per category. Real production deployment requires wiring the JS to gate analytics/marketing scripts based on user choice — the modal is the UI layer only.overflow: hidden to <body> or <html>, the scrollbar disappears — the page content JUMPS right by ~15px (the scrollbar width). Fix: add padding-right: 15px to compensate (or use overflow: hidden; scrollbar-gutter: stable on modern browsers). Modern browsers with overlay scrollbars (macOS, mobile) don't have this issue. 2. Content shift when modal position: absolute is added: if the modal isn't rendered in the DOM initially and is added on open, subsequent content can shift. Fix: render the modal in the DOM at page load with opacity: 0; visibility: hidden, then toggle to visible. This is how every demo in this collection works. 3. Late-loading images inside modal without reserved dimensions: if the modal contains <img> tags that load asynchronously, images shift the modal content after open. Fix: set width + height attributes on <img> OR use aspect-ratio on containers. 4. Font swap during modal display: if the modal uses a web font that hasn't loaded, the fallback font renders first, then swaps to the web font — causing text reflow inside the modal. Fix: font-display: optional or pair font-display: swap with size-adjust in @font-face. Modal-opening animation itself doesn't cause CLS — transform and opacity are compositor-only. But if you animate width / height / top / left instead of transform, you'll trigger layout on every frame. Always use transform + opacity for modal transitions. Testing tools: Chrome DevTools Performance Insights, Lighthouse, Core Web Vitals report in Google Search Console, WebPageTest.<script type="application/ld+json"> schema.org/Article + isAccessibleForFree: false + hasPart pointing to the paid section. The Wall Street Journal, FT, and Bloomberg use hard paywalls. (2) Metered paywall — users get N free articles per month before the modal appears. NYT ships 10/month, Washington Post 8/month, Medium 3/month, Substack varies per author. The counter is client-side (localStorage/cookies) with server-side reconciliation. Design requirements for Demo #04 Paywall Modal in this collection: (a) blurred backdrop over the article using backdrop-filter: blur(6px) so users can see there IS content behind (increases conversion 15-25% per Piano.io research vs a hard curtain). (b) Clear headline ("Read the full article — Subscribe today"), prominent price ($5/month, $50/year with savings badge), "Already a subscriber? Log in" secondary action. (c) Real content signal — show the first paragraph or two above the blur so users see the article is genuinely valuable. (d) Prevent inspect-element bypass by server-side gating the actual article HTML — client-side blur alone is trivially defeated. (e) SEO: use meta name="robots" content="noarchive" to prevent cached full content, plus schema.org paywall markup so Google indexes without penalizing. Compliance callouts: (1) EU users under the ePrivacy Directive need cookie consent BEFORE the meter counter cookie is set — Demo #07 GDPR modal must fire first. (2) California CCPA requires "Do Not Sell or Share My Personal Info" link even on paywall subscription flows. (3) FTC 16 CFR § 425 (Negative Option Rule) requires subscription auto-renewal disclosures within the modal — "Subscription auto-renews at $5/month until cancelled" MUST be visible, not buried in TOS. (4) California AB 390 (2018) and NY GBL § 526-b require one-click cancellation matching the subscribe flow's simplicity — link to /cancel from every payment modal. Non-compliance with the negative option rule cost Amazon $25M FTC settlement in 2023 (Prime cancellation flow), Vonage $100M FTC settlement in 2022, and Adobe $40M FTC action in 2024. Demo #04 in this collection ships the blurred-backdrop + headline + price + login-link + compliance-copy structure. Server-side gating and Stripe billing integration are your integration work. Recommended architecture: static content page → server checks subscription cookie → renders full article OR renders truncated version + paywall modal on demand.<dialog> triggered by keydown listener for e.metaKey || e.ctrlKey + e.key === 'k', calling preventDefault() to override browser find. (b) <input type="search" autofocus> at the top with role="combobox" + aria-controls pointing to the results list. (c) Results list is a role="listbox" with role="option" children; keyboard arrow up/down moves aria-selected without scrolling the input, Enter commits the selected option. (d) Fuzzy search using fzf algorithm (or the tiny fuse.js — 6KB — if you don't want to hand-roll). Notion and Linear both use hand-rolled fuzzy scoring; Cursor uses Fuse; VSCode uses its own QuickPick algorithm ported to Monaco. (e) Recent items section above unfiltered results — Linear and Notion both surface the last 5 accessed items when the palette opens empty. (f) Category headings inside the listbox using role="presentation" so screen readers don't announce them as options. (g) Keyboard shortcut hints on the right (e.g. ↵ to open, ⌘↵ to open in new tab, Esc to close) — the Linear pattern that trains power users. Performance: index all commands once on page load; debounce filter (150ms) so typing doesn't hammer the fuzzy scorer; virtual-scroll if results exceed 100 items (Notion virtual-scrolls at 50). Accessibility: role="combobox" + aria-expanded="true" + aria-autocomplete="list" + aria-activedescendant pointing to the selected option's ID. Screen readers announce "combobox, 12 results, X of Y" as the user types. Announcing result count via aria-live="polite" region ensures the user knows filtering happened. Multi-modal input: mouse hover on an option should ALSO set aria-selected so the keyboard-arrow-active option stays in sync with mouse pointer — the pattern GitHub gets slightly wrong (their arrow keys and mouse hover fight each other), which Notion gets right. Commercial libraries to compare against: cmdk by Paco Coursey (13KB React-only, powers Linear and Vercel dashboard), kbar (18KB React-only), ninja-keys (11KB vanilla web component), tinykeys (0.4KB just for the shortcut binding). This collection ships the pattern in vanilla HTML/CSS/JS with zero framework lock-in — copy-paste into React, Vue, Svelte, Astro, or plain HTML. The Cmd+K modal is the #1 signal that separates "just-a-tool" from "power-user platform" in tier-1 SaaS product design.role='dialog', aria-modal='true', aria-labelledby, focus trap, focus return on close, Escape closes, backdrop click closes, body scroll lock). Every demo honours prefers-reduced-motion: reduce (transitions fall back to instant show/hide). Every demo uses semantic HTML (<button> for buttons, <h2> for titles, proper form labels). Verify your specific use case with axe DevTools, Lighthouse, WAVE, or WebAIM tools before shipping to EU EAA / US Section 508 / Canada ACA / UK Equality Act audits — the demos are AA-compliant by default but layout context matters. Compliance trap warnings are embedded in per-demo gotchas: PCI DSS for payment (Demo #04), HIPAA for healthcare (Demo #05), GDPR Article 7 for cookies (Demo #07) + signup consent (Demo #03), NIST SP 800-63B for password rules (Demo #03, #18), CCPA for California cookie banners (Demo #07), PSD2 SCA for EU payments (Demo #04). These are the real business risks; documenting them is a trust signal. Consult your legal / compliance team before production deployment in regulated verticals — the demos are starting points, not legal advice.15 mouse-aware 3D tilt hover cards — e-commerce product spotlight, glassmorphism parallax team card, interactive pricing tier, holographic NFT collectible, pop-out mascot, dark tech grid with border glow, media player album art, blog article preview, cyberpunk neon glow, dashboard KPI widget, minimalist real estate, flip-to-back tilt, mobile app showcase, course learning card, and a Pure CSS touch-friendly tilt. Vanilla JS writes --rx/--ry/--mx/--my; all rendering stays in CSS on the GPU.
24 hand-coded CSS animated card patterns organised by what triggers the motion, not by card style. Scroll and entrance triggers: staggered grid reveals, @starting-style mount-in, scroll-driven scale and fade on animation-timeline: view(), View Transitions API card-to-detail morphs, blur-to-sharp lazy image loading, and FLIP re-layout when a filter changes. State-change triggers: add-to-cart success morph, like and save particle burst, expand and collapse to intrinsic height with calc-size(), swipe-to-dismiss on Pointer Events, and skeleton-to-loaded crossfade. Data-driven triggers: count-up KPI metrics, SVG sparkline draw-on-enter, and progress ring fill on load. Ambient idle loops: breathing glow, floating drift, animated gradient mesh backgrounds, conic rotating borders, auto-cycling testimonial decks, and live status pulses. Plus four hover patterns where the effect is the topic itself: cursor spotlight, holographic foil glare, corner ribbon slide, and horizontal accordion expand. Every card is scoped under a .ac-NN prefix for no-collision pasting, guards prefers-reduced-motion, animates compositor-only properties, and ports unchanged to React, Vue, Svelte, Astro, Next.js and Tailwind.
22 hand-coded CSS avatars for chat apps, team dashboards, comment threads, account menus, and social profiles. Covers circular and squircle shapes, gradient and conic story rings, hexagon clip-path crops, online status dots, notification count badges, verified checkmarks, stacked facepiles with plus-N overflow, initials fallbacks for users without photos, broken-image recovery, avatar pickers, and a size scale system where the ring, badge, and status dot all scale from a single custom property.