Custom CSS Reference
CookieRay Pro lets you add your own CSS to the consent banner. This page lists the classes you can target, explains why some rules need !important, and gives examples to start from. For where the field lives and its limits, see Trust Badge and Custom CSS.
Where to add it
Open CookieRay → Banner Design and scroll to Advanced. The field holds up to 5,000 characters and is applied on your live site only. The admin live preview does not show it, so check changes on a real page. Open your site in a private window to see the banner.
Why some rules need !important
Two things work against a plain override:
- Inline styles. The banner sets some values directly on the element from your Banner Design settings: the corner radius, the headline and icon colors, the description color, the privacy link color, and the floating button background. A normal CSS rule cannot beat an inline style, but a rule with
!importantcan. - Load order. Your custom CSS is printed in the page head before CookieRay’s own stylesheet. At equal specificity the later stylesheet wins, so make your selector more specific (start with
.cookieray-banner-root) or add!important.
The action buttons are styled with !important rules of fairly high specificity. To override them, use !important and a longer selector, for example .cookieray-banner-root .cookieray-btn-primary.cookieray-btn.cookieray-btn. Use .cookieray-prefs-root in place of .cookieray-banner-root for the buttons in the preferences modal. The Accept button’s background and text colors also come from CSS variables set on the button itself.
Classes you can target
Banner
| Class | What it is |
|---|---|
.cookieray-banner-root | Fixed wrapper that holds the banner (sets the default font) |
.cookieray-overlay | Dark backdrop, present only when the overlay option is on |
.cookieray-banner | The banner box itself |
.cookieray-layout-card, .cookieray-layout-bar | Added to .cookieray-banner for the chosen layout |
.cookieray-pos-bottom-right, .cookieray-pos-top-center and the other seven | Added for the chosen position |
.cookieray-inner | Inner container |
.cookieray-header | Row with the icon and the text |
.cookieray-icon-tile | The cookie icon tile |
.cookieray-text | Text column |
.cookieray-headline | Banner headline |
.cookieray-desc | Banner description |
.cookieray-privacy-link | Privacy policy link |
.cookieray-actions, .cookieray-actions-row | Button containers |
.cookieray-btn | All buttons |
.cookieray-btn-primary | Accept button (also “Save preferences” in the modal) |
.cookieray-btn-ghost | Settings button |
.cookieray-btn-outline | Decline button (also “Cancel” in the modal) |
Preferences modal (opens from the Settings button)
| Class | What it is |
|---|---|
.cookieray-prefs-root | Wrapper |
.cookieray-prefs-backdrop | Backdrop behind the modal |
.cookieray-prefs-modal | The modal box |
.cookieray-prefs-title, .cookieray-prefs-desc | Modal heading and intro |
.cookieray-prefs-list | List of categories |
.cookieray-prefs-row | One category row |
.cookieray-prefs-row-title, .cookieray-prefs-row-desc | Category name and description |
.cookieray-switch, .cookieray-slider | The category toggle |
.cookieray-prefs-actions | Modal buttons |
Other elements
| Class | What it is |
|---|---|
.cookieray-manage-pill | Floating cookie settings button (Show Floating Cookie Settings Button) |
.cookieray-ccpa-link | Do Not Sell link for visitors detected in the US |
Class names can change in future versions. If a rule stops working after an update, inspect the banner in your browser and check the class names again.
Examples
Paste only what you need.
Use your site font
.cookieray-banner-root,
.cookieray-prefs-root {
font-family: inherit !important;
}
Sharper corners
.cookieray-banner,
.cookieray-prefs-modal {
border-radius: 4px !important;
}
Change the headline color
.cookieray-banner-root .cookieray-headline {
color: #111827 !important;
}
Change the accept button color
.cookieray-banner-root .cookieray-btn-primary.cookieray-btn.cookieray-btn {
background: #0f766e !important;
color: #ffffff !important;
}
Round the buttons
.cookieray-banner-root .cookieray-btn.cookieray-btn.cookieray-btn {
border-radius: 999px !important;
}
Move the floating button higher (to clear a chat widget)
.cookieray-manage-pill {
bottom: 90px !important;
}
Hide the icon tile
.cookieray-icon-tile {
display: none !important;
}
Check it works
- Save in Banner Design.
- Open your site in a private window. If the banner does not show, you may already have given consent. Clear the site cookies and reload.
- If a rule has no effect, inspect the element, look at the Styles panel, and add
!importantand a longer selector. - If your site uses a caching or CSS-optimization plugin, clear its cache so the new
<style>block is served.
Limits and safety
- Up to 5,000 characters. Anything past that is cut off when you save.
- The text
</styleis neutralized when saving, so you cannot close the style block early. - Saving new custom CSS needs an active Pro license. Without one the field is locked. CSS you already saved keeps applying on your live site if the license later lapses, but you cannot edit it until Pro is active again.