FAQ
Quick answers to the most common questions about banner custom CSS.
Can I use JavaScript in custom CSS?
Section titled “Can I use JavaScript in custom CSS?”No. The field accepts CSS only. JavaScript in url(javascript:...) values or expression() calls is stripped by the sanitizer. If you need JavaScript behavior on the consent decision, use the Kookiok JavaScript API (window.Kookiok, Kookiok:consentUpdate events).
Can I use a custom font?
Section titled “Can I use a custom font?”Yes, with two conditions:
-
The font must be self-hosted — you cannot use Google Fonts CDN or any third-party font CDN. Loading external resources from the banner would send visitor IP addresses to that third party, creating a GDPR data transfer (LG München 3 O 17493/20 confirmed €100 damages for this via Google Fonts).
-
The font must be loaded by the host page (
<link>in<head>pointing to your own origin). Then reference it via token override:
:host { --font-family: "My Brand Font", system-ui, sans-serif;}Can I add new cookie categories?
Section titled “Can I add new cookie categories?”No. The category structure (Necessary, Preferences, Statistics, Marketing) is fixed by the banner configuration, not by custom CSS. CSS cannot add DOM elements — it can only style existing ones.
What is the character limit?
Section titled “What is the character limit?”10,000 characters. This counts the raw CSS before sanitization. Token overrides are very compact — a typical full brand override is under 500 characters.
Can I remove the “Powered by KookiOk” branding?
Section titled “Can I remove the “Powered by KookiOk” branding?”Not with CSS: those selectors are blocked, and the badge is also locked with inline !important styles at runtime that prevent any CSS override.
The badge is part of the free plan. The paid “No branding” plan removes the KookiOk branding your visitors see, the badge included, and so does “Full”: you choose a plan in the Plans and billing tab of your account. See Branding Policy.
Can I add my own HTML to the banner?
Section titled “Can I add my own HTML to the banner?”No. Custom CSS is CSS-only. The banner DOM is generated by consent-runtime.js and cannot be modified from the admin editor.
Does the customCss field work in the preview API endpoint?
Section titled “Does the customCss field work in the preview API endpoint?”Yes. The banner preview endpoint (/banner-preview) accepts a customCss query parameter. You can use it to preview changes programmatically before calling the save API:
GET /banner-preview?templateId=classic&layout=dialog&customCss=:host%7B--radius:4px%7DCan I use SCSS or other CSS preprocessors?
Section titled “Can I use SCSS or other CSS preprocessors?”The custom CSS field accepts plain CSS only. Pre-process your SCSS locally and paste the compiled output. The 10,000 character limit applies to the compiled CSS, so minification is recommended.
Why does the sanitizer strip my @import?
Section titled “Why does the sanitizer strip my @import?”@import loads external stylesheets. In the context of the banner Shadow DOM, this would:
- Send the visitor’s IP address to the external origin (GDPR data transfer).
- Bypass the site’s Content Security Policy.
- Potentially load unsafe styles.
Load fonts and external styles on the host page instead. They will not affect the banner DOM (Shadow DOM isolation) but fonts loaded on the host page can be referenced via --font-family.
Can I switch templates without losing my custom CSS?
Section titled “Can I switch templates without losing my custom CSS?”Yes. Selecting a different template in the editor replaces the recipe styles but keeps your custom CSS. The preview updates immediately so you can check compatibility. If a token you override is no longer used by the new template, the override is harmless (it just has no effect).
Can I set different CSS per locale?
Section titled “Can I set different CSS per locale?”Not currently. Custom CSS applies globally across all locales of a banner. Per-locale CSS overrides are on the roadmap.
How big is the schema JSON?
Section titled “How big is the schema JSON?”As of v2026.05.18, banner-schema.json is approximately 22KB uncompressed, 6KB gzipped. Suitable for inclusion in AI context windows.