Secure Privacy

How to Add Custom CSS to Your Secure Privacy Cookie Banner: Inner Banner & Outer Wrapper Styling Guide

Learn how to apply custom CSS to both the inner iframe and outer wrapper of your Secure Privacy cookie banner — including the SP-OUTER-START syntax for container-level styling — with troubleshooting tips and best practices.

SPT
Secure Privacy Team
4 min read ()

Summary: This guide explains how to apply custom CSS to your Secure Privacy cookie banner—both inside the banner iframe and to its outer wrapper container. Whether you want to adjust padding, button styles, text colors, positioning, or shadows, this walkthrough covers the correct approach for each scope, including the /SP-OUTER-START/ and /SP-OUTER-END/ syntax for outer container styling.

Who Is This Guide For?

  • Website administrators and designers customizing the visual appearance of their Secure Privacy cookie banner
  • Developers applying CSS to fine-tune banner styles beyond the visual editor's options
  • Marketers and compliance managers maintaining brand consistency across their consent UI

1. Styling Elements Inside the Banner (iframe CSS)

  • In your Secure Privacy dashboard, navigate to Design > Cookie Banner. You will find a Custom CSS input field located directly below the banner preview on the design page.

Secure Privacy design page showing the Custom CSS input field below the cookie banner preview
The Custom CSS field in Secure Privacy's design editor — located below the banner preview panel.
  • CSS entered here is applied within the banner's iframe. This means it can target and style inner banner elements such as padding, text colors, typography, and button styles — but it is scoped to the banner only and will not affect the rest of your website.

Example of custom CSS applied inside a Secure Privacy cookie banner iframe, targeting button and text elements
Inner banner CSS is scoped to the iframe — safely targeting banner elements without affecting the rest of your page.

2. Styling the Banner Outer Wrapper Container

  • To style the banner's outer container—such as its position, box shadow, margin, or z-index—wrap your CSS rules between the following special comment tags in the same Custom CSS field:

/*SP-OUTER-START*/

/* Your CSS code for the outer wrapper goes here */

/*SP-OUTER-END*/
Secure Privacy Custom CSS field showing the SP-OUTER-START and SP-OUTER-END comment tags wrapping outer wrapper CSS rules
Wrap outer container CSS between /*SP-OUTER-START*/ and /*SP-OUTER-END*/ in the Custom CSS field.
  • CSS placed between these tags is injected directly into your website's HTML, outside the iframe, and targets the banner's outer container element. This makes it suitable for layout-level properties like positioning and shadows.

Important: Risks of Outer Wrapper CSS

Warning example showing how outer wrapper CSS injected into page HTML can affect other website elements if selectors are not specific
Outer wrapper CSS is injected into the page HTML — use specific selectors and test carefully to avoid unintended styling conflicts.
  • CSS changes inside the banner aren't affecting the outer wrapper?
    Inner banner CSS applies only within the iframe and cannot reach the outer container. To style the outer wrapper, use the /*SP-OUTER-START*/ ... /*SP-OUTER-END*/ syntax as described above.

  • Outer wrapper styles are affecting other parts of your website?
    Your CSS selectors are likely too broad. Scope them as specifically as possible to the banner's outer container class. Always test on a staging site before pushing to production to catch unintended side effects.

  • Concerned about the risks of injecting CSS into page HTML?
    Yes — outer wrapper CSS is injected directly into your site's HTML, so careless or generic styles can override other page elements. Use highly specific selectors, avoid global resets, and review changes in DevTools before publishing.

Frequently Asked Questions (FAQ)

What is the difference between inner banner CSS and outer wrapper CSS in Secure Privacy?

Inner banner CSS is scoped inside the banner's iframe and can only affect elements within the banner itself—such as buttons, text, and padding. Outer wrapper CSS, placed between /*SP-OUTER-START*/ and /*SP-OUTER-END*/, is injected into the page HTML and controls the outer container's layout properties like position, margin, and shadow.

Can inner banner CSS affect my website's other elements?

No. Because inner banner CSS is applied inside an iframe, it is fully isolated from the rest of your page. Only CSS placed between the /*SP-OUTER-START*/ and /*SP-OUTER-END*/ tags can affect elements outside the banner.

Where exactly do I add custom CSS in Secure Privacy?

Go to Design > Cookie Banner in your Secure Privacy dashboard. The Custom CSS input field is located below the banner preview. Both inner and outer wrapper CSS rules are entered in this same field — the /*SP-OUTER-START*/ tags differentiate which scope applies.

What kinds of styles should I apply to the outer wrapper vs the inner banner?

Use inner banner CSS for typography, colors, padding, and button styles. Use outer wrapper CSS for positioning, margins, box shadows, z-index, and other layout-level properties that control how the banner sits on the page.

Need More Help with Banner CSS Customization?

If you have questions or need assistance with custom CSS for your Secure Privacy cookie banner, contact our support team at [email protected].

Need more help?

Our privacy experts are here to guide you through complex regulations and find the right solution.

Contact Support

Related Articles

View all