Target the cookie banner, Preferences Center, and embed placeholders from your own code
TermsFeed Privacy Consent (CMP) gives your code 7 CSS custom properties, 2 root IDs, and named buttons and links to target the cookie banner without relying on its inner markup. Every ID the script renders starts with termsfeed_pc1_ and uses underscores. Every class starts with termsfeed-pc1- and uses hyphens, and every attribute starts with data-termsfeed-pc1-, apart from termsfeed-pc1-vendor-tag-id.
These names are what the current script renders, and TermsFeed has published no commitment to keep them across script updates. Re-check your rules with Versions and Changelog.
CSS custom properties for the colors of the consent banner
The 4 color properties override the palette wherever you set them: on :root, on a palette class, or on a root element. Each rule reads --termsfeed-pc1-<color> first, then its alias --termsfeed-privacy-consent--<color>, then the palette. A consent banner type that offers the "Corners" setting on the Appearance page has its own palette defaults, in the last 2 columns.
| Property | Light | Dark | Light, with "Corners" | Dark, with "Corners" |
|---|---|---|---|---|
--termsfeed-pc1-banner-background-color |
#F2F2F2 |
#181c27 |
#FFFFFF |
#181C27 |
--termsfeed-pc1-banner-text-color |
#000 |
#fff |
#161B26 |
#F2F4F8 |
--termsfeed-pc1-button-background-color |
#006ADE |
#006ADE |
#006ADE |
#4C8DF6 |
--termsfeed-pc1-button-text-color |
#FFF |
#FFF |
#FFFFFF |
#0A0F1A |
With the Custom palette, the colors you set in the TermsFeed app win over a :root value, because the script writes them as inline styles on :root. The next rule sets all 4 properties for the other 2 palettes.
:root {
--termsfeed-pc1-banner-background-color: #0f1117;
--termsfeed-pc1-banner-text-color: #e8ecf2;
--termsfeed-pc1-button-background-color: #2f6fed;
--termsfeed-pc1-button-text-color: #ffffff;
}
The Light, Dark, and Custom palettes in the TermsFeed app change the same 4 properties with no code. Choose one in Colors and Themes.
CSS custom properties for the font and the corners
These 3 properties change what the Appearance page sets for the font and the corners. The 2 radius properties apply only with a consent banner type that offers the "Corners" setting, and they override the corners classes.
| Property | Default | Effect |
|---|---|---|
--termsfeed-pc1-font-family |
The font chosen on the Appearance page | Overrides the font, with every consent banner type |
--termsfeed-pc1-radius |
0, 12px, or 20px, from the "Corners" setting |
Sets the radius of panels and cards |
--termsfeed-pc1-button-radius |
0, 8px, or a pill, from the "Corners" setting |
Sets the radius of buttons |
Root IDs and the other root elements
The consent banner and the Preferences Center each have a root ID, and a selector you write starts best from one of them. The embed placeholder has a root class because it repeats, and the floating buttons have a container.
| Selector | Element | Position and stacking | Exists |
|---|---|---|---|
#termsfeed_pc1_notice_banner |
The consent banner, role="dialog" |
Fixed at the top left with z-index: 9999. Its child .termsfeed-pc1-notice-banner-layout is the fixed box at the bottom of the viewport, so target that child to move or size the consent banner |
While it shows, inside <body>, until the visitor answers or closes it |
#termsfeed_pc1_preferences_center |
The Preferences Center, role="dialog" |
Fixed over the viewport, z-index: 999999 |
Only while open. The script adds it to <body> on open and removes it on close. |
.termsfeed-pc1-ec |
The embed placeholder, inside .termsfeed-pc1-ec-wrapper |
In the page flow, under the consent banner and the Preferences Center | From the moment the script starts, for each iframe or img replaceable tag and each <div> for HTML vendor tags |
#termsfeed_pc1_sticky_element_placeholder, class termsfeed-pc1-sticky-element |
The floating buttons container | Fixed near the bottom corner, z-index: 999 |
On every page view, for every visitor, at the end of <body> |
Classes on the root elements
These classes say which appearance a root has. The script sets them from the Appearance page, so read them in your selectors and leave them in place.
| Class | Meaning |
|---|---|
termsfeed-pc1-reset |
Stops inherited website styles at the root |
termsfeed-pc1-notice-banner-style-<type> |
The consent banner type chosen on the Appearance page |
termsfeed-pc1-color-palette-light, -dark, -custom |
The palette |
termsfeed-pc1-font-helvetica, -georgia, -inherited, -system |
The font |
termsfeed-pc1-lang-<lang> |
The language of the visit, which the root carries in its lang attribute too. termsfeed-pc1-lang-ar turns on the right-to-left rules, with dir="rtl" on the root. |
termsfeed-pc1-modern |
A consent banner type that offers the "Corners" setting |
termsfeed-pc1-corners-square, -soft, -round |
The corner radius, with that consent banner type |
termsfeed-pc1-position-left, -right |
The side of a card and of the floating buttons, with that consent banner type |
termsfeed-pc1-preferences-center-style-sheet, -dialog |
The Preferences Center layout, with that consent banner type |
Button and link selectors
The buttons and links carry fixed IDs, and the embed placeholder buttons carry fixed classes because they repeat. A button the owner hides in the TermsFeed app is removed from the consent banner, so its selector matches nothing.
| Selector | Label | Location |
|---|---|---|
#termsfeed_pc1_notice_banner_accept_all_button |
I Agree | Consent banner |
#termsfeed_pc1_notice_banner_reject_all_button |
I Decline | Consent banner |
#termsfeed_pc1_notice_banner_save_preferences_button |
Save Selection, hidden until a toggle differs | Consent banner |
#termsfeed_pc1_notice_banner_close_button |
Close | Consent banner |
#termsfeed_pc1_notice_banner_open_privacy_preferences |
"Privacy Preferences" link | Consent banner text |
#termsfeed_pc1_notice_banner_open_privacy_choices |
"Your Privacy Choices" link | Consent banner text, where the US opt-out parts apply |
#termsfeed_pc1_preferences_center_save_selection_button |
Save Preferences | Preferences Center |
#termsfeed_pc1_preferences_center_close_button |
Close | Preferences Center |
#termsfeed_pc1_preferences_center_exit_button |
× | Preferences Center |
#termsfeed_pc1_sticky_element_open |
"Privacy Preferences" | Floating button |
#termsfeed_pc1_sticky_privacy_choices_element_open |
"Your Privacy Choices" | Floating button |
.termsfeed-pc1-ec-acceptall-button, .termsfeed-pc1-ec-rejectall-button |
I Agree, I Decline | Embed placeholder |
.termsfeed-pc1-ec-accept-vendor-button, .termsfeed-pc1-ec-decline-vendor-button |
Accept this vendor, Decline this vendor | Embed placeholder |
The embed placeholder holds another button, .termsfeed-pc1-ec-accept-vendor-category-button, which the script renders hidden.
Toggle IDs and vendor category containers
The script gives each toggle checkbox an ID when it builds the consent banner and the Preferences Center. In these selectors, <category> is a vendor category ID such as analytics.
| Selector | Element |
|---|---|
#termsfeed_pc1_notice_banner_toggle_vendor_category_<category> |
A vendor category checkbox in the consent banner |
#termsfeed_pc1_preferences_center_toggle_vendor_category_<category> |
A vendor category checkbox in the Preferences Center |
#termsfeed_pc1_preferences_center_toggle_vendor_<vendor id> |
A vendor checkbox in the Preferences Center |
#termsfeed_pc1_preferences_center_toggle_dnsmpi, #termsfeed_pc1_preferences_center_toggle_lspi |
The Do Not Sell or Share and Limit the Use checkboxes |
#termsfeed_pc1_notice_banner_vendor_category_<category> |
The row of a vendor category in the consent banner |
#termsfeed_pc1_preferences_center_vendors_category_<category>, #termsfeed_pc1_preferences_center_details_<category> |
The section and the <details> element of a vendor category in the Preferences Center |
Elements you provide on your own pages
These selectors belong to your markup and keep their names without the termsfeed_pc1_ start. A click on a trigger works on the element and on anything inside it, including an element your code adds after the script started. A trigger or a parent link with an empty href or href="#" does not jump to the top of the page.
| Selector | Effect |
|---|---|
#open_privacy_preferences_element |
Opens the Preferences Center |
.termsfeed-pc1-open-privacy-preferences |
Opens the Preferences Center, on any number of elements |
#open_privacy_choices_element, #open_dnsmpi_element |
Opens the Preferences Center at the Your Privacy Choices heading |
div#<vendor id> |
Receives the HTML vendor tags of that vendor, and shows its embed placeholder until consent. The data-termsfeed-vendor-name attribute the app adds to the markup only labels it. |
A link in your footer is the usual place for a trigger. Add it with Reopen Preferences. Find the replaceable tag elements you write, with their 2 attributes, in the JavaScript API Reference.
Elements Privacy Consent adds to your page
The script adds these elements beside the root elements. Style them through their selectors and leave their markup to the script.
| Selector | Element | Where and when |
|---|---|---|
<style> with no ID |
The Privacy Consent stylesheet | End of <head>, as soon as the code runs |
#termsfeed_pc1_custom_css |
The Custom CSS from the Appearance page, on a <style> element |
End of <head>, after the stylesheet, only when a Custom CSS is present |
.termsfeed-pc1-ec-wrapper |
The embed wrapper, height: 100% of its container |
In a plain <div> right after each replaceable tag, or inside div#<vendor id> |
.termsfeed-pc1-ec-wrapper[data-termsfeed-pc1-render-embed="false"] |
A wrapper with no embed placeholder, for each script, style, or link replaceable tag and each vendor with JavaScript, Style, or Link vendor tags |
Right after that replaceable tag, or at the end of <body> for the vendor |
[termsfeed-pc1-vendor-tag-id] |
Each top-level element a vendor tag or a replaceable tag inserts | <head> or the end of <body> for JavaScript, Style, and Link vendor tags, div#<vendor id> for HTML vendor tags, and the container beside the wrapper for a replaceable tag |
State classes the script sets
These classes change while the visitor uses the page, or decide which parts the visit shows. Read them in scripts and style them, but never set them yourself.
| Selector | Meaning |
|---|---|
.termsfeed-pc1-hidden |
display: none !important. An embed wrapper gets it once the vendor is allowed to run. |
.termsfeed-pc1-ec-wrapper.termsfeed-pc1-is-declined |
The saved answer declines the vendor, so the embed placeholder shows its declined title |
.termsfeed-pc1-is-mixed |
A vendor category in the consent banner with only some vendors on |
label.termsfeed-pc1-custom-toggle[aria-checked] |
The state of a toggle: true, false, or mixed in the consent banner |
.termsfeed-pc1-dnsmpi |
A US opt-out part: Do Not Sell or Share, Limit the Use, or Your Privacy Choices. The script removes it where the US opt-out parts do not apply. |
.termsfeed-pc1-lspi |
A Limit the Use part, rendered hidden, then shown or removed |
.termsfeed-pc1-gpc, .termsfeed-pc1-gpc-optout, .termsfeed-pc1-gpc-optin |
The Global Privacy Control notice and its 2 texts, for visitors who send the signal |
.termsfeed-pc1-privacy-choices-link, .termsfeed-pc1-privacy-choices-icon |
The Your Privacy Choices link and floating button, and the California opt-out icon in them |
.termsfeed-pc1-notice-banner-content-sensitive, .termsfeed-pc1-preferences-center-content-vendors-item-sensitive, .termsfeed-pc1-ec-sensitive |
The sensitive data sentence, the "Sensitive data" label on a vendor, and the embed placeholder note |
Attributes you write and attributes the script writes
You write data-termsfeed-pc1-vendor-id and, optionally, data-termsfeed-pc1-replaceable-tag-id on a replaceable tag. The script writes the attributes that follow on the elements it creates. Read them while debugging, and base no logic on them.
| Attribute | Written on | Value |
|---|---|---|
termsfeed-pc1-vendor-tag-id |
Each inserted vendor tag element | The vendor ID for an HTML vendor tag, <vendor id>-javascript, -style, or -link for the others, or the ID of the replaceable tag |
data-termsfeed-pc1-vendor-transient |
Each element an on-load transient vendor tag inserts | The vendor ID. The script removes these elements once a saved answer exists. |
data-termsfeed-pc1-vendor-id |
Embed wrappers, and vendor checkboxes in the Preferences Center | The vendor ID |
data-termsfeed-pc1-vendor-category |
Embed wrappers | The vendor category ID |
data-termsfeed-pc1-vendor-name, data-termsfeed-pc1-vendor-privacy-policy-url |
Embed wrappers | The values the embed placeholder shows |
data-termsfeed-pc1-render-embed |
Embed wrappers | true shows an embed placeholder |
data-termsfeed-pc1-replaceable-tag-id |
Embed wrappers, and each replaceable tag without one | The ID of the replaceable tag |
data-termsfeed-pc1-vendor-category-id |
Vendor category checkboxes | The vendor category ID |
data-termsfeed-pc1-vendor-targeted, data-termsfeed-pc1-vendor-category-targeted |
Embed placeholder buttons | The vendor and the vendor category the button acts on |
data-termsfeed-pc1-section |
The US sections of the Preferences Center | privacy-choices, dnsmpi, or lspi |
data-termsfeed-pc1-open-section |
The Your Privacy Choices link and the US floating buttons | The section they open the Preferences Center at |
Which selectors are not stable
Every other class under a root is a structural hook for the Privacy Consent stylesheet, and nothing commits the script to keeping it. The families start with termsfeed-pc1-notice-banner-, termsfeed-pc1-preferences-center-, termsfeed-pc1-ec-, and termsfeed-pc1-custom-toggle-.
A positional selector such as #termsfeed_pc1_notice_banner > div > div:nth-child(2) stops matching when the nesting changes. A chain of internal classes stops matching when one class gets a new name. A selector on label text fails for visitors in other languages, because the script shows each visit in its own language. Start from a root ID or a listed selector and add as few internal classes as the rule needs.
How your CSS reaches the consent banner
Each root takes all: initial, and everything inside it takes all: unset, so inherited website styles stop at the root. The --termsfeed-pc1-* custom properties pass the reset, and the "Inherited" card of "Choose a font" brings back the font of your website. The Privacy Consent stylesheet then styles each part. A website rule that matches an inner element and outranks the Privacy Consent rule still applies, such as body.home a, a:hover, or any !important.
Your own rule needs a selector at least as specific as the rule it overrides, so prefix it with a root ID: #termsfeed_pc1_notice_banner .termsfeed-pc1-notice-banner-footer-rejectall-button. A Custom CSS rule comes later in the document than the stylesheet, so it wins a tie of equal specificity. Write the rules with Custom CSS.
2 rules for styling the consent banner and embed placeholders
Keep refusing as easy as accepting. Never hide, shrink, or move #termsfeed_pc1_notice_banner_reject_all_button away from I Agree, because a consent banner that makes refusing harder than accepting puts the consent you collect in doubt. Test your styled consent banner with Equal Accept and Reject.
Keep each embed placeholder informative. Never remove the vendor name or the Privacy Policy link from .termsfeed-pc1-ec, because the visitor decides there and needs to know who receives the data. Size the embed placeholder through its container, since the script copies no width or height from the replaceable tag. Style it with Embed Placeholders.
How to check a selector on your page
Check each rule on a published page with any page cache cleared, since a cache keeps serving the earlier stylesheet. The check takes 4 steps in Chrome DevTools.
- Open your site in a private window, open Chrome DevTools, and filter the Network tab for
termsfeedtag. The Privacy Consent requests appear. - Select the Elements tab, press Ctrl+F (Cmd+F on a Mac), and search for
id="termsfeed_pc1_sticky_element_placeholder". Every page view holds that element. - Search for
id="termsfeed_pc1_notice_banner". The element appears on a visit where the consent banner asks, and a visit on the opt-out model does not hold it. - Select the element, open the Computed pane, and read the property your rule sets. The pane shows your value.