Skip to content

Age Verification Gate

A copy-paste cookie & consent component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Cookie & ConsentHTMLCSSany framework

Copy into your project

HTML
<div class="nuda-ck2-age-gate" role="dialog" aria-modal="true"
     aria-labelledby="ck2-age-gate-title" aria-describedby="ck2-age-gate-desc">
  <div class="nuda-ck2-age-gate__icon" aria-hidden="true">
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"
         stroke-linecap="round" stroke-linejoin="round" width="20" height="20">
      <circle cx="12" cy="8" r="4" />
      <path d="M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8" />
    </svg>
  </div>
  <p id="ck2-age-gate-title" class="nuda-ck2-age-gate__title">Confirm your age</p>
  <p id="ck2-age-gate-desc" class="nuda-ck2-age-gate__desc">
    You must be 18 or older to view this content and the cookies it sets.
  </p>
  <div class="nuda-ck2-age-gate__actions">
    <button type="button" class="nuda-ck2-age-gate__btn nuda-ck2-age-gate__btn--no">I'm under 18</button>
    <button type="button" class="nuda-ck2-age-gate__btn nuda-ck2-age-gate__btn--yes">I'm 18 or older</button>
  </div>
</div>
CSS
.nuda-ck2-age-gate {
  width: 300px;
  box-sizing: border-box;
  background: #141414;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 1.2rem 1.3rem;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0,0,0,.6);
  animation: _nuda-ck2agegateIn .45s cubic-bezier(.16,1,.3,1) both;
}

.nuda-ck2-age-gate__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(228,255,84,.1);
  color: #e4ff54;
  margin: 0 auto .7rem;
}

.nuda-ck2-age-gate__title {
  color: #fafafa;
  font-size: .9rem;
  font-weight: 700;
  margin: 0 0 .35rem;
}

.nuda-ck2-age-gate__desc {
  color: #777;
  font-size: .72rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

.nuda-ck2-age-gate__actions {
  display: flex;
  gap: .5rem;
}

.nuda-ck2-age-gate__btn {
  flex: 1;
  min-height: 44px;
  border-radius: 9px;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s,transform .15s;
}

.nuda-ck2-age-gate__btn:hover {
  opacity: .85;
}

.nuda-ck2-age-gate__btn:active {
  transform: scale(.97);
}

.nuda-ck2-age-gate__btn:focus-visible {
  outline: 2px solid #e4ff54;
  outline-offset: 2px;
}

.nuda-ck2-age-gate__btn--no {
  background: rgba(255,255,255,.08);
  color: #cfcfcf;
  border: 1px solid rgba(255,255,255,.14);
}

.nuda-ck2-age-gate__btn--yes {
  background: #e4ff54;
  color: #0a0a0a;
  border: 1px solid transparent;
}

@keyframes _nuda-ck2agegateIn {
  from {
    opacity: 0;
    transform: scale(.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-ck2-age-gate {
    animation: none !important;
  }
}

How to use Age Verification Gate

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More cookie & consent components

← Browse all NudaUI components