Change the spacing, font, and position of your cookie banner with CSS
Write CSS rules for your TermsFeed Privacy Consent cookie banner where the Appearance page has no setting for the change you want. The Appearance page already sets the consent banner type, the position of a Card, the corners, the font, and the colors, so try those first. Your rules then handle what is left, such as the inner spacing or the distance from a fixed footer.
You need access to the consent banner in the TermsFeed app, or edit access to the stylesheet of your website. The steps at the end take about 10 minutes.
Where your CSS rules go
Put your rules in the "Custom CSS" field of the Appearance page or in your own stylesheet, because both reach every page that loads the consent banner. The TermsFeed server sends the saved field with the settings of your consent banner, and the app preview applies it too.
The 2 places differ in the order the browser reads them.
| Where | How it loads | What it means for your rules |
|---|---|---|
| The "Custom CSS" field | In <style id="termsfeed_pc1_custom_css"> at the end of <head>, after the Privacy Consent stylesheet |
A rule beats a Privacy Consent rule of the same specificity |
| Your own stylesheet | Before the Privacy Consent stylesheet, which the script adds to <head> when it runs |
A Privacy Consent rule of the same specificity beats it, so start each one with an ID |
The field takes up to 20,000 characters. It drops anything that loads a file or runs code: url(), the image functions, @import, @font-face, and every at-rule except @media, @supports, @container, @layer, and @keyframes. A note under the field starts "Not applied on your website:" and names what it dropped.
Some accounts show the field locked under the strip "Custom CSS". Use your own stylesheet in that case.
Start each rule from a root element
Privacy Consent draws 4 parts, and each has a root element that your rules start from. Inherited website styles, such as a font or a text color, stop at these roots. The first 3 roots have fixed IDs.
| Root | What it holds |
|---|---|
#termsfeed_pc1_notice_banner |
The consent banner |
#termsfeed_pc1_preferences_center |
The Preferences Center, in the page only while it is open |
#termsfeed_pc1_sticky_element_placeholder |
The floating buttons |
.termsfeed-pc1-ec |
Each embed placeholder, styled with the rules in Embed Placeholders |
A website rule that matches an element inside a root and outranks the Privacy Consent rule still applies. A rule such as body.home a, a:hover, or anything with !important changes a link in the consent banner. Write a rule that starts from the root ID to take the link back.
How to override the color, font, and corner variables
Set the custom properties Privacy Consent reads, which change one value everywhere without a selector for each part. A value set on :root applies to every part. The radius properties apply to "Card", "Bar", and "Panel" only.
:root {
--termsfeed-pc1-button-background-color: #0a7d3e;
--termsfeed-pc1-button-text-color: #ffffff;
--termsfeed-pc1-font-family: "Inter", Arial, sans-serif;
--termsfeed-pc1-radius: 6px;
--termsfeed-pc1-button-radius: 6px;
}
A font named in --termsfeed-pc1-font-family has to load on your page already, because Privacy Consent does not load a font file. The "Inherited" card of "Choose a font" uses the font of your website with no CSS.
The "Custom" color theme writes its 4 colors on :root as inline styles, and those beat a :root rule in a stylesheet. Set the colors on the root elements in that case, as this block does for visitors whose device uses dark mode.
@media (prefers-color-scheme: dark) {
.termsfeed-pc1-notice-banner,
.termsfeed-pc1-preferences-center,
.termsfeed-pc1-ec,
.termsfeed-pc1-sticky-element {
--termsfeed-pc1-banner-background-color: #102a43;
--termsfeed-pc1-banner-text-color: #ffffff;
--termsfeed-pc1-button-background-color: #1a54a9;
--termsfeed-pc1-button-text-color: #ffffff;
}
}
Common changes to spacing and position
Most changes that the Appearance page does not offer move the consent banner away from something else on your page or give it more room. The 3 rules in this block cover the usual cases. Keep the ones you need and change the values.
/* Give the consent banner more room inside */
#termsfeed_pc1_notice_banner .termsfeed-pc1-notice-banner-inner {
padding: 28px;
}
/* Lift a Card or a Panel above a fixed footer on wider screens */
@media (min-width: 641px) {
#termsfeed_pc1_notice_banner .termsfeed-pc1-notice-banner-layout {
bottom: 80px;
}
}
/* Lift the floating buttons above a chat widget */
#termsfeed_pc1_sticky_element_placeholder {
bottom: 88px;
}
The media query in the second rule matters. On a screen up to 640px wide, "Card", "Bar", and "Panel" become a sheet across the bottom. A lifted sheet leaves a gap under it on a phone. Fix a consent banner that covers your page on a phone with Covers Content on Mobile.
Why the "I Decline" button stays visible
Style the "I Agree" and "I Decline" buttons with one rule, and never hide, shrink, or fade the "I Decline" button. A paler or hidden button sends a visitor who wants to refuse into the Preferences Center, while accepting stays one click. The General Data Protection Regulation (GDPR) asks that refusing be as easy as accepting. The same reasoning covers 'Hide the "Reject all" button in the consent banner?', which the app itself warns you to keep off for visitors in the EU.
A rule that lists both IDs keeps every change equal.
#termsfeed_pc1_notice_banner_accept_all_button,
#termsfeed_pc1_notice_banner_reject_all_button {
border-radius: 6px;
min-width: 140px;
}
Each button stays as wide as its label until a rule sets a width, so the labels in other languages decide how even the pair looks. Run the test for equal buttons from Equal Accept and Reject.
Selectors that break between releases
Prefer the IDs, the custom properties, and the classes the contract lists, because the other class names inside a root are hooks for the Privacy Consent stylesheet. TermsFeed does not commit to keeping the name of a hook. .termsfeed-pc1-notice-banner-inner and .termsfeed-pc1-notice-banner-layout, which the spacing rules use, are hooks of this kind.
Avoid :nth-child() and selectors built on label text, which change with the language and the consent banner type. A renamed hook shows only as a rule that stopped working, so re-check your rules after a Privacy Consent release. Look up each stable name in the DOM and CSS contract.
How to add and check your CSS
Adding and checking the rules takes 5 steps.
- Paste your rules into your own stylesheet and publish it, or paste them into "Custom CSS" on the Appearance page and click "Save Appearance".
- Clear the page cache of your website or caching plugin.
- For rules in "Custom CSS", click "Preview" on the Appearance page and check them on the example website at each "Device" width.
- Open your website in a new private window, so the consent banner appears again.
- Verify the rules. Open Chrome DevTools, select the Network tab, filter for
termsfeedtag, and reload to confirm that the requests return status 200. Then select the Elements tab, click#termsfeed_pc1_notice_banner_reject_all_button, and confirm in the Styles pane that your rule applies and is not struck through. Turn on the device toolbar at 375px wide and confirm that I Agree and I Decline both show without scrolling.
The consent banner now shows your rules to every visitor who loads the new stylesheet or the new settings. Check rules for #termsfeed_pc1_preferences_center with the Preferences Center open, since it leaves the page when it closes.