Custom CSS usage¶
Feature availability
This feature is available only in the Premium Web, Enterprise, Business and Corporate subscriptions. Learn more about the available features on the pricing page.
Script tag version
This documentation applies only if you are using V3 script tag on your website.
Applying CSS changes¶
Disclaimer
By using Custom CSS, you will be in control of your custom UI. Your CSS adjustments will affect the layout of your CMP and possibly also of your website. You'll make these adjustments at your own risk and outside of the sphere of the Usercentrics support.
To enable custom CSS, follow these steps:
- Open the Usercentrics Admin Interface
- Navigate to Appearance - Styling.
- Add your CSS code into the 'Custom CSS' field.
Custom CSS is not parsed in any way, but is directly embedded within a <style>
tag in the Shadow DOM housing the CMP.
Entry points¶
CMP¶
The following selectors can be modified within the CMP:
CSS Selector | Description | Visual Guide Link |
---|---|---|
#uc-main-dialog | References the main CMP container | Visual Guide |
#uc-privacy-title | References the title in the main CMP text area | Visual Guide |
#uc-privacy-description | References the description in the main CMP text area | Visual Guide |
#more | References the "More" action button | Visual Guide |
#deny | References the "Deny" action button | Visual Guide |
#accept | References the "Accept" action button | Visual Guide |
#save | References the "Save" action button | Visual Guide |
.uc-button-link | References every link under the CMP text area | Visual Guide |
.uc-toggle | References every toggle in the CMP | Visual Guide |
#uc-[identifier]-[id]-toggle | References a specific toggle in the CMP | Visual Guide |
#uc-tabs-header | References the second layer tab header | Visual Guide |
.uc-expandable-card | References every expandable card in the CMP | Visual Guide |
#controller-id-item | References the Controller ID specific expandable card | Visual Guide |
.uc-details-title | References every title for every service section inside the expandable cards | Visual Guide |
.uc-details-description | References every description in every service section inside the expandable cards | Visual Guide |
.uc-details-tag | References every tag in every service section inside the expandable cards | Visual Guide |
Service modal¶
When a service or subservice is opened in a standalone view, a modal is generated for this specific purpose. Multiple modals can be open at the same time and they share their internal structure with the expandable cards within the CMP. As a result, .uc-details-[..]
namespaced selectors such as .uc-details-title
and .uc-details-description
are also applicable within this context. The modal-specfic entry points are:
CSS Selector | Description | Visual Guide Link |
---|---|---|
.uc-modal-overlay | References every modal wrapper | Visual Guide |
.uc-modal | References every modal main container | Visual Guide |
.uc-modal-header | References every modal header element | Visual Guide |
.uc-modal-footer | References every modal footer element | Visual Guide |
Info
Read more about how to style both the CMP and modals conditionally under Conditional styling
Tip
Custom CSS can technically be applied to any element; however, these predefined entry points are provided to streamline the customization process for your convenience.
Conditional styling¶
The selector #uc-main-dialog
designates the primary container within the CMP.
Illustration
This container may have additional classes that allow for the targeting of elements on specific CMP layers or under specific device and configuration conditions. To apply CSS targeting based on devices or layers, these classes can be concatenated with the selector for the main container. The following classes represent various device-related criteria, layer distinctions, language direction, and framework indicators available for customization on the main dialog container.
Devices¶
Class | Screen size | Breakpoint |
---|---|---|
.xs | Extra small | < 360 px |
.mobile | Small | > 360 px |
.tablet | Medium | > 768 px |
.desktop | Large | > 1024 px |
Layers¶
Class | Layer name |
---|---|
.first | First layer |
.second | Second layer |
Language direction¶
Class | Language Direction |
---|---|
.ltr | Left-to-Right |
.rtl | Right-to-Left |
Framework indicator¶
Class | Legal Framework |
---|---|
.gpdr | General Data Protection Regulation (GDPR) |
.tcf | Transparency and Consent Framework (TCF) |
.ccpa | California Consumer Privacy Act (CCPA) |
GPC message¶
The GPC message appears when the banner recognizes a GPC signal.
Id | Description |
---|---|
#uc-gpc-signal | Wrapper for the message |
#uc-gpc-icon | Icon for the message |
#uc-gpc-text | Text of the message |
Examples (CMP)¶
#uc-main-dialog.mobile.second {
/* Custom CSS styles for the cmp container on the second layer on mobile devices */
/* Add your styles here */
}
To direct your styling towards a specific element within the CMP on a particular device, you can use the device modifier by attaching it to the main container as the root targeting element.
#uc-main-dialog.tablet .uc-expandable-card {
/* Custom CSS styles for expandable cards on tablet */
/* Add your styles here */
}
Service modal¶
The selector .uc-modal-overlay
designates every primary modal wrapper.
Illustration
The service modal elements exist as standalone components outside the primary CMP container. As a result, the device-related classes are also present on the modal wrappers.
Examples (Modal)¶
.uc-modal-wrapper.desktop .uc-details-title {
/* Custom CSS styles for modal service section titles on desktop */
/* Add your styles here */
}
.uc-modal-footer button {
/* Custom CSS styles for the modal footer button */
/* Add your styles here */
}
Tip
The usage of the device modifier is optional, as you can place your own media queries for precise screen targeting within Custom CSS if this is more suitable.
Visual guide¶
CMP First Layer¶
Illustration
CMP Second Layer¶
Illustration (1 / 2)
Illustration (2 / 2)
Service Modal¶
Illustration