Skip to content

Custom CSS Overview

Custom CSS lets you restyle any part of the consent banner — colors, fonts, radius, layout — while the GDPR compliance rules remain server-enforced and untouchable.

The Kookiok consent UI renders inside a Shadow DOM — a browser-native isolation boundary that prevents your site’s styles from leaking in and the consent UI’s styles from leaking out. Custom CSS is a snippet you write in the banner editor that gets injected inside those Shadow Roots, after the template’s own styles, giving you fine-grained control over appearance.

Since v2026.08.04 the same snippet reaches all three consent surfaces — the banner, the floating privacy trigger, and the preferences popup — each in its own Shadow Root.

Think of it in three layers:

  1. Template recipe — sets the overall visual personality (colors, shadow, animation).
  2. Design tokens — CSS custom properties (--radius, --btn-fill, --surface, …) that you can override to adjust the recipe without replacing it.
  3. Class overrides — direct rules targeting .ag-banner, .ag-btn, .ag-title, etc. for anything tokens can’t express.
ScenarioRecommended approach
Change brand colorOverride --btn-fill, --accent tokens
Adjust corner roundnessOverride --radius token
Compact padding on mobileClass override @media rule on .ag-banner-inner
Custom fontOverride --font-family token (self-hosted only)
Full visual redesignClass overrides + token overrides combined

For most brand alignment tasks, token overrides alone are sufficient and are less likely to break when Kookiok updates the default template styling.

The compliance checker also flags CSS patterns that would violate GDPR — hiding the Reject button, pre-checking non-necessary categories, or creating visual asymmetry between Accept and Reject. See GDPR Compliance Risks.

Browser tab
└── Shadow Host (#__AG_CONSENT_HOST__)
└── Shadow Root ← isolation boundary
├── <style> [recipe CSS — token defaults]
├── <style> [your custom CSS] ← injected here
└── .ag-overlay
└── .ag-banner
└── ...banner DOM

Your CSS is injected as a <style> tag inside each consent Shadow Root. This means:

  • Your site’s external stylesheets have no effect on the banner.
  • The banner’s styles have no effect on your site.
  • Standard CSS selector specificity applies within each Shadow Root.
  • Selectors only match inside the surface they belong to, so one snippet can safely style the banner, the privacy trigger and the preferences popup at once.
  • 10,000 character maximum per banner.
  • A sanitizer strips dangerous patterns (expression(), javascript:, @import, etc.) silently.
  • Branding-targeting rules return HTTP 422 with a structured error listing which selectors were rejected.